我正在尝试以下内容,我的报告中也没有参数,我也使用.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
参数计数不匹配。
答案 0 :(得分: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