我创建了一个包含2个表中的字段的报表,但是CR自动复制了“详细信息”部分中的数据,这在a **中很麻烦。有什么方法可以消除这种行为?
到目前为止,这是我的代码:
Dim reportsfolder As String = Application.StartupPath + "\PrintArea\"
Dim comand As New SqlDataAdapter("SELECT JV.DateEntry, JV.Explanation, JVD.* FROM GeneralJournal JV LEFT JOIN GeneralJournalData JVD ON JV.ReferenceCode = JVD.ReferenceCode WHERE JV.ReferenceCode = '" & MetroLabel4.Text & txtJV.Text & "' AND JVD.Code <> ''", jonsqlcon)
Dim cmtable As New DataTable
comand.Fill(cmtable)
Dim cryRpt As New ReportDocument
cryRpt.Load(reportsfolder + "PrintGeneralJournal.rpt")
''''for dblogin
Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
Dim crTableLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim ConnInfo As New CrystalDecisions.Shared.ConnectionInfo()
ConnInfo.ServerName = tmpSN
ConnInfo.DatabaseName = tmpDBN
ConnInfo.UserID = tmpUID
ConnInfo.Password = tmpPass
ClientViewer.CrystalReportViewer1.ReportSource = Nothing
cryRpt.SetDataSource(cmtable)
For Each crTable In cryRpt.Database.Tables
crTableLogonInfo = crTable.LogOnInfo
crTableLogonInfo.ConnectionInfo = ConnInfo
crTable.ApplyLogOnInfo(crTableLogonInfo)
Next
cryRpt.SetParameterValue("CompanyName", cname)
ClientViewer.CrystalReportViewer1.ReportSource = cryRpt
ClientViewer.CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.IntegratedSecurity = True
ClientViewer.CrystalReportViewer1.Refresh()
ClientViewer.ShowDialog()
也请查看输出结果