如何在CrystalReport中解决这个问题 [英] How To Slove This In CrystalReport
本文介绍了如何在CrystalReport中解决这个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用Datatable绑定Crystal
我的代码:
< pre lang =c#> cnn.Open();
DataTable dt1 = new DataTable();
dt1 = Dt_Args( 从ShiftTable中选择EmpNameC,日期为'01 / Oct / 2014',empcodeC =' 18' 跨度>); // 执行数据表的Dt_Args方法
DataSet ds = new DataSet();
ds.Tables.Add(dt1);
objRpt.SetDataSource(ds);
crystalReportViewer1.ReportSource = objRpt;
crystalReportViewer1.Refresh();
它运行没有任何问题,但没有在水晶报告中显示。解决方案你可以试试这个
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath( CrystalReportTest.rpt));
rptDoc.SetDataSource(ds.Tables [ YourTable]);
crystalReportViewer1.ReportSource = rptDoc;
crystalReportViewer1.Refresh();
Hi, i have try to bind Crystal with using Datatable
My Code:
cnn.Open();
DataTable dt1 = new DataTable();
dt1 = Dt_Args("select EmpNameC from ShiftTable where dated'01/Oct/2014'and empcodeC='18'"); // Dt_Args method to execute datatable
DataSet ds = new DataSet();
ds.Tables.Add(dt1);
objRpt.SetDataSource(ds);
crystalReportViewer1.ReportSource = objRpt;
crystalReportViewer1.Refresh();
it run without any issue but not showing in crystal report.
解决方案
Can you try with this
ReportDocument rptDoc = new ReportDocument(); rptDoc.Load(Server.MapPath("CrystalReportTest.rpt")); rptDoc.SetDataSource(ds.Tables["YourTable"]); crystalReportViewer1.ReportSource = rptDoc; crystalReportViewer1.Refresh();
这篇关于如何在CrystalReport中解决这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文