现在用户需求如下图:
我想使用子报表,最后把所有的报表集合在一起,现在我单独设计好了三个报表
单独使用这三个报表都可以查询到数据,现在把三个报表放在一张报表中的详细资料中,如下图
代码如下:
protected void Page_Load(object sender, EventArgs e)
{
string sDBConnetction = @"Data Source=localhost;Initial Catalog=Report;Persist Security Info=True;User ID=sa;pwd=sqladmin";
//string sDBConnetction = "server=localhost;database=report;uid=sa;pwd=sqladmin";
SqlConnection conn = new SqlConnection(sDBConnetction);
conn.Open();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("select * from yelian_product",conn);
da.Fill(ds, "yelian_product");
ds.Tables[0].TableName = "yelian_product";
SqlDataAdapter da2 = new SqlDataAdapter("select * from yelian_productdata", conn);
da2.Fill(ds, "yelian_productdata");
ds.Tables[1].TableName = "yelian_productdata";
SqlDataAdapter da3 = new SqlDataAdapter("select * from yelian_downtime_day", conn);
da3.Fill(ds, "yelian_downtime_day");
ds.Tables[2].TableName = "yelian_downtime_day";
string reportPath = System.Threading.Thread.GetDomain().BaseDirectory + "Rpt/main.rpt";
CrystalReportSource1.ReportDocument.Load(reportPath);
CrystalReportSource1.ReportDocument.SetDataSource(ds);
CrystalReportSource1.DataBind();
this.CrystalReportViewer1.ReportSource = this.CrystalReportSource1;
CrystalReportViewer1.DataBind();
conn.Close();
}
运行时出现如下的提示信息
请问该如何解决,是在什么地方出的问题?谢谢各位!