水晶报表 打印 主及子报表的数据源绑定
2012-09-11 12:49
337 查看
//设置主报表数据源
strSQL = "SELECT * FROM tbl_A where id = '" + ViewState["ID"].ToString() + "'";
string strCon = ConfigurationManager.AppSettings["KSCCPLATConnectionString"];
DataSet ds = SQLSrv.GeneralQuery(strSQL, strCon);
ds.Tables[0].TableName = "tbl_A ";
reportDocument = new ReportDocument();
reportDocument.Load(Server.MapPath("../CR/JGRYDJ.rpt"));
reportDocument.SetDataSource(ds);
//设置子报表数据源
DataSet dss = SQLSrv.GeneralQuery("SELECT * FROM tbl_Aa where jlid = '" + ds.Tables[0].Rows[0]["Id"].ToString() + "'", strCon);
dss.Tables[0].TableName = "tbl_Aa";
reportDocument.OpenSubreport("JGRYDJQTRY").SetDataSource(dss);
CRV.ReportSource = reportDocument;
strSQL = "SELECT * FROM tbl_A where id = '" + ViewState["ID"].ToString() + "'";
string strCon = ConfigurationManager.AppSettings["KSCCPLATConnectionString"];
DataSet ds = SQLSrv.GeneralQuery(strSQL, strCon);
ds.Tables[0].TableName = "tbl_A ";
reportDocument = new ReportDocument();
reportDocument.Load(Server.MapPath("../CR/JGRYDJ.rpt"));
reportDocument.SetDataSource(ds);
//设置子报表数据源
DataSet dss = SQLSrv.GeneralQuery("SELECT * FROM tbl_Aa where jlid = '" + ds.Tables[0].Rows[0]["Id"].ToString() + "'", strCon);
dss.Tables[0].TableName = "tbl_Aa";
reportDocument.OpenSubreport("JGRYDJQTRY").SetDataSource(dss);
CRV.ReportSource = reportDocument;
相关文章推荐
- [转]VS2005下水晶报表实现动态数据源绑定
- access数据库使用水晶报表(PUSH)推模式实现多数据源含子报表的订单打印
- C#实现水晶报表绑定数据并实现打印
- [转]VS2005下水晶报表实现动态数据源绑定
- VS2005下水晶报表如何实现动态数据源绑定?
- VS2005下水晶报表如何实现动态数据源绑定
- VS2005下水晶报表实现动态数据源绑定
- VS2005下水晶报表如何实现动态数据源绑定?
- 水晶报表数据源绑定
- C# 水晶报表打印 绑定数据库表
- C# 水晶报表打印 绑定数据库表
- VS2005下水晶报表如何实现动态数据源绑定?
- VS2005中的水晶报表也可以用推模式动态绑定数据源
- 动态水晶报表扩展:任意无关联多表,任意列,任意数据源
- push模式的水晶报表,参数的设置要放在数据源设置之后
- vs2005 水晶报表横向打印Bug
- 水晶报表连续打印
- 水晶报表使用经验谈1--建立水晶报表第一步及编译最易出现错误的解决方法及报表转换成pdf文档进行打印方法
- 在Silverlight中动态绑定页面报表(PageReport)的数据源
- C#创建无数据源水晶报表极简教程(PUSH模式)