我现在要根据3个表的联合查询的数据来绑定报表,查询的结果没问题,但是绑定后怎么数据确实查出啦的结果一直重复显示
代码是这样的
sql = "select * from Transactions,InvoiceTable,CustTable where Transactions.InvoNumNew=InvoiceTable.InvoNumNew and InvoiceTable.CustNum=CustTable.CustCode "
If Frminvoice.DataGridView1.RowCount >= 1 Then
sql = sql + "and InvoiceTable.InvoNumNew ='" & Frminvoice.DataGridView1(0, Frminvoice.DataGridView1.CurrentRow.Index).Value.ToString() & "' "
Else
sql = sql + "and InvoiceTable.[Date]=(select max([Date]) from InvoiceTable) "
End If
da = New OleDbDataAdapter(sql, myConn)
myDataSet = New DataSet2()
da.Fill(myDataSet, "tables")
Dim crpttick = New CrptTicked()
crpttick.SetDataSource(myDataSet.Tables("tables"))
CrystalReportViewer1.ReportSource = crpttick
DataSet2