您的位置:首页 > 其它

水晶报表 打印 主及子报表的数据源绑定

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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  报表 dataset string