绑定水晶报表时,提示无效的报表源
stringmyConnectionString="server=server;database=dzbl0521;UserID=lead;password=sunshi...
string myConnectionString = "server=server;database=dzbl0521;User ID=lead;password=sunshine";
SqlConnection myConnection = new SqlConnection(myConnectionString);
string mySelectQuery = "select * from his_ct";
SqlDataAdapter myDataAdapter = new SqlDataAdapter(mySelectQuery, myConnection);
//DataSet1为用XML 架构定义语言 (XSD) 描述的DataSet架构
DataSet dsBill = new DataSet();
// 连接到数据库、从数据库中获取数据然后断开数据库连接
myDataAdapter.Fill(dsBill, "his_ct");//要注意TbAutoDispatchBill要求跟你的数据库表名称一致
////实例化水晶报表
//CrystalReport_Bill CR_Bill = new CrystalReport_Bill();
////将填充的数据集传递给报表
//CR_Bill.SetDataSource(dsBill);
//设置报表源,将该报表对象绑定到 Web 窗体查看器
crystalReportViewer1.ReportSource = dsBill; 展开
SqlConnection myConnection = new SqlConnection(myConnectionString);
string mySelectQuery = "select * from his_ct";
SqlDataAdapter myDataAdapter = new SqlDataAdapter(mySelectQuery, myConnection);
//DataSet1为用XML 架构定义语言 (XSD) 描述的DataSet架构
DataSet dsBill = new DataSet();
// 连接到数据库、从数据库中获取数据然后断开数据库连接
myDataAdapter.Fill(dsBill, "his_ct");//要注意TbAutoDispatchBill要求跟你的数据库表名称一致
////实例化水晶报表
//CrystalReport_Bill CR_Bill = new CrystalReport_Bill();
////将填充的数据集传递给报表
//CR_Bill.SetDataSource(dsBill);
//设置报表源,将该报表对象绑定到 Web 窗体查看器
crystalReportViewer1.ReportSource = dsBill; 展开
1个回答
展开全部
你还没有绑定呀,
报表源是这样
string path = Server.MapPath("CBaoBuDan.rpt");
CrystalReportSource1.ReportDocument.Load(path);
CrystalReportSource1.ReportDocument.SetDataSource(ds);
CrystalReportSource1.DataBind();
CrystalReportViewer1.ReportSource = CrystalReportSource1;
CrystalReportViewer1.DataBind();
报表源是这样
string path = Server.MapPath("CBaoBuDan.rpt");
CrystalReportSource1.ReportDocument.Load(path);
CrystalReportSource1.ReportDocument.SetDataSource(ds);
CrystalReportSource1.DataBind();
CrystalReportViewer1.ReportSource = CrystalReportSource1;
CrystalReportViewer1.DataBind();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询