我想将C#中SQL Server的两个表中的数据加载到Crystal Reports数据集中。当我这样尝试时:
private void LoadReport()
{
try
{
SQLConn.sqL = (@"SELECT TD.InvoiceNo,
P.Description,
P.Product,
TD.ItemPrice,
TD.Quantity,
TD.Amount,
TD.DiscPercent,
TD.DiscAmount,
TD.NetAmount,
Cu.CusName FROM product as P,
transactionDetails as TD,
customer as Cu
WHERE P.ProductNo = '2' And TD.CusID = Cu.CusID");
SQLConn.ConnDB();
SQLConn.cmd = new SqlCommand(SQLConn.sqL, SQLConn.conn);
SQLConn.da = new SqlDataAdapter(SQLConn.cmd);
ProductDataset ds = new ProductDataset();
SQLConn.da.Fill(ds);
rptProduct report = new rptProduct();
report.SetDataSource(ds);
RptProductViewer1.ReportSource = report;
RptProductViewer1.Refresh();
}
catch (Exception ex)
{
Interaction.MsgBox(ex.ToString());
}
}
我遇到了错误,并且没有将数据加载到数据集,因为我已经在SQL Server查询执行程序中检查了查询的完美性。
请告诉我将多个表数据加载到Crystal Reports中的最佳方法
收到此异常... GitHub
添加ds.tables [“ transactiondetails”]后,出现了此异常 enter image description here