我有一个数据库,我想在我的报告(水晶报告)中,在我的代码中使用它的几个表。
testdbDataSet ds = new testdbDataSet();
testdbDataSetTableAdapters.ProductsTableAdapter productAdapter = new testdbDataSetTableAdapters.ProductsTableAdapter();
productAdapter.Fill(ds.Products);
testdbDataSetTableAdapters.RegionTableAdapter regionAdapter = new testdbDataSetTableAdapters.RegionTableAdapter();
regionAdapter.Fill(ds.Region);
ds.AcceptChanges();
ReportDocument reportDoc = new ReportDocument();
reportDoc.FileName = "CrystalReport1.rpt";
reportDoc.SetDataSource(ds);
crystalReportViewer1.ReportSource = reportDoc;
crystalReportViewer1.Show();crystalReportViewer没有显示我的报告
我检查了堆栈溢出上的this链接,但未能完成。
发布于 2014-03-26 10:56:58
testdbDataSet ds = new testdbDataSet();
//FETCH FROM ANYWHERE TO a DataTable
DataTable _DtFrmDBPrd = new DataTable();
DataTable _DtFrmDBRgn = new DataTable();
_DtFrmDBPrd = GetDataFrmDBPrd();//Filling the DataTable From DB or any where..
_DtFrmDBRgn = GetDataFrmDBRgn();
ds.Products.Merge(_DtFrmDBPrd);//Both the Data Table should have the same column name and Data Type
ds.Region.Merge(_DtFrmDBRgn);
ReportDocument reportDoc = new ReportDocument();
reportDoc.FileName = "CrystalReport1.rpt";
reportDoc.SetDataSource(ds);
crystalReportViewer1.ReportSource = reportDoc;
crystalReportViewer1.Show();https://stackoverflow.com/questions/22655249
复制相似问题