Click here to Skip to main content
15,071,430 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a code to display data on datagridview (To check) and crystal reports

The problem is I am getting duplicate entry on crystal report while datagridview is ok and showing single entry..
For each entry in data grid view there is duplicate entry on crystal report. Thanks for help in advance

What I have tried:

Private Sub Butt_searchInvoice(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Butt_searchInvoice.Click
                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")
                   CrystalReportViewer1.ReportSource = Path
                   objcon .Close 
       End Sub

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900