本文介绍了水晶报表和数据集连接性问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有人,
我通过OLEDB SQL Provider使用存储过程制作了一个Crystal Report.
我想通过asp.net中的数据集"或数据表"访问此报告
我的代码如下.
Dear All,
i make one crystal Report Using Stored procedure through OLEDB SQL Provider.
i want to access this report through DataSet Or Datatable in asp.net
my code is given below.
string connectionString =string)ConfigurationManager.AppSettings["ConnectionString"];
ConnDeemah.ConnectionString = connectionString;
SqlCommand cmd = new SqlCommand("RptNetSaleAndCollectionByBusinesType", ConnDeemah);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@strIDs",Session["stID"].ToString());
cmd.Parameters.AddWithValue("@strdtFromDate",Session["FromDate"].ToString());
cmd.Parameters.AddWithValue("@strdtToDate",Session["ToDate"].ToString());
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataTable DataTable1 = new DataTable();
adapter.Fill(DataTable1);
我如何将此DataTable1分配给crystalReport ...
请帮助我....
感谢
how can i assign this DataTable1 to crystalReport...
please help me....
thanks
推荐答案
string connectionString =string)ConfigurationManager.AppSettings["ConnectionString"];
ConnDeemah.ConnectionString = connectionString;
SqlCommand cmd = new SqlCommand("RptNetSaleAndCollectionByBusinesType", ConnDeemah);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@strIDs",Session["stID"].ToString());
cmd.Parameters.AddWithValue("@strdtFromDate",Session["FromDate"].ToString());
cmd.Parameters.AddWithValue("@strdtToDate",Session["ToDate"].ToString());
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataTable DataTable1 = new DataTable();
adapter.Fill(DataTable1);
现在,创建ReportDocument
对象&然后分配DataTable
.然后将ReportDocument分配给ReportViewer
.
Now, create ReportDocument
object & then assign the DataTable
. Then assign the ReportDocument to ReportViewer
.
ReportDocument rpt = new ReportDocument();
rpt.SetDataSource(DataTable1);
CrystalReportViewer1.ReportSource = rpt;
这篇关于水晶报表和数据集连接性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!