rsites2

rsites2

  • NA
  • 2
  • 3.8k

its got to be right there.... (crystal reports with ado.net)

Jan 28 2005 3:52 PM
I have a embedded crystal report that has an ado dataset datasource that is assigned at runtime. I include a msgbox to show how many records were in the dataset, but no matter what, the report does not show the parameterized dataset (which should be 1 record), it shows all of the records in the database table.... PLEASE HELP! Private Sub Print_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Print.Click Dim invoiceconnection As New OleDb.OleDbConnection, type, many As Integer invoiceconnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "\spiral.mdb" Dim invoiceadapter As New OleDb.OleDbDataAdapter Dim selec, jn As String jn = InputBox("Enter Job Number", "Print Job Number") selec = "SELECT * FROM tblBids WHERE jobnumber = ?" Dim selectcommand As New OleDb.OleDbCommand(selec, invoiceconnection) invoiceadapter.SelectCommand = selectcommand selectcommand.Parameters.Add("jobnumber", OleDb.OleDbType.VarChar, 15).Value = jn Dim invoicedataset As New DataSet invoiceadapter.Fill(invoicedataset, "tblbids") Dim invoicereport As New Invoice invoicereport.SetDataSource(invoicedataset) many = invoicedataset.Tables(0).Rows.Count MsgBox(many) ' this is here to show me how many records in the dataset Me.CrystalReportViewer1.ReportSource = invoicereport type = InputBox("Print press 1 or Export to PDF press 2", "Type") If type = 1 Then Me.CrystalReportViewer1.PrintReport() Else Me.CrystalReportViewer1.ExportReport() End If End Sub