0

我正在尝试以下操作,并且我的报告不包含任何参数,我也在使用 .Net Objects

 Dim data = GetDataConnection()
 Dim ds = (From th In data.TranHeads Where th.THCSCode = "YYY001"
              Select th).ToList

 Dim crySalesTran As ReportDocument = New IBS_DAL.rep_SalesTransaction

 crySalesTran.SetDataSource(ds.AsEnumerable)

 CrystalReportViewer1.ReportSource = crySalesTran

出于某种原因,当它到达 setdatasource

TargetParameterCountException
参数计数不匹配。

4

1 回答 1

0

我找到了答案,尽管不确定为什么会这样,而另一个选项却不行

Dim da = New System.Data.SqlClient.SqlDataAdapter("SELECT THSysRef, THCSCode FROM TranHead Where THCSCode = "YYY001" ", data.Connection)
Dim dtTH = New DataTable
da.Fill(dtTH)

Dim crySalesTran As ReportDocument = New IBS_DAL.rep_SalesTransaction
crySalesTran.Database.Tables(0).SetDataSource(dtTH)

CrystalReportViewer1.ReportSource = crySalesTran
于 2013-08-09T11:52:28.973 回答