我的代码显示数据网格视图和报告的数据。当datagridview正确显示单个条目时,为什么我在报告中会出现重复的条目?
Private Sub Butt_searchInvoice(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Butt_searchInvoice.Click
connect()
sql = "select distinct SALESINVOice.[Invoice NO],[Invoice Date], " _
& "[Customer Name], Productname,Qty,Rate,amount from salesinvoice " _
& " inner join salesinvoicedetails on SALESINVOICE.[Invoice NO]= " _
& " salesinvoicedetails.[Invoice No] " _
& "where salesinvoice.[Invoice NO] = '" & txt_invoiceNO.Text & "' "
objcmd = New SqlCommand(sql, objcon)
objda.SelectCommand = objcmd
Dim ds as new dataset
objda.Fill(ds, "stt")
''displaying in datagridview
DataGridview1.DataSource = ds.Tables("stt")
''displaying Data in Crystal report
Dim Path as new SalesInvoicerpt()
Path.Load(Application.StartupPath + "C:\SalesInvoicerpt.rpt")
Path.SetDataSource(ds.Tables("stt"))
CrystalReportViewer1.ReportSource = Path
CrystalReportViewer1.RefreshReport()
objcon .Close
End Sub