报告中显示重复数据

时间:2016-08-15 18:45:32

标签: vb.net crystal-reports

我的代码显示数据网格视图和报告的数据。当datagridview正确显示单个条目时,为什么我在报告中会出现重复的条目?

enter image description here

enter image description here

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

1 个答案:

答案 0 :(得分:0)

打开您的部分专家并突出显示第3组详细信息。在抑制公式条目旁边添加此公式。 enter image description here

{SALESINVOice.Productname}=previous({SALESINVOice.Productname})