一聚教程网:一个值得你收藏的教程网站

热门教程

水晶报表中子报表的数据绑定问题

时间:2022-07-02 11:31:27 编辑:袖梨 来源:一聚教程网

是否被水晶报表中子报表的数据绑定问题折磨过?这也是我另一文章所说的问题
http://www.cnblogs.com/haozidong/archive/2004/10/20/54489.html
你可以通过单独用代码绑定子报表来解决这个问题。
string sConnectionString = ConfigurationSettings.AppSettings["dbCommISMS"];

SqlConnection sqlConn = new SqlConnection(sConnectionString);
SqlCommand sqlComm = new SqlCommand();
SqlDataAdapter dataAdapter = new SqlDataAdapter();
sqlConn.Open();
sqlComm.Connection = sqlConn;
sqlComm.CommandType = CommandType.Text;
dataAdapter.SelectCommand = sqlComm;
Dataset1 dataSet = new Dataset1();
string sSQL = "SELECT * FROM T_REQUEST WHERE APPLI_ID = '" + appli_id + "'";
sqlComm.CommandText = sSQL;
dataAdapter.Fill(dataSet, "T_REQUEST");
sSQL = "SELECT * FROM T_REQUEST_INSPECTION WHERE APPLI_ID = '" + appli_id + "'";
sqlComm.CommandText = sSQL;
dataAdapter.Fill(dataSet, "T_REQUEST_INSPECTION");
sSQL = "SELECT * FROM T_ACCEPT_INSPECTION WHERE APPLI_ID = '" + appli_id + "'";
sqlComm.CommandText = sSQL;
dataAdapter.Fill(dataSet, "T_ACCEPT_INSPECTION");
SubreportObject oSubreport1 = oRpt.ReportFooterSection1.ReportObjects["Subreport1"] as SubreportObject;
ReportDocument oSub1 = oSubreport1.OpenSubreport("Inspection");
oSub1.SetDataSource(dataSet);
SubreportObject oSubreport2 = oRpt.ReportFooterSection2.ReportObjects["Subreport2"] as SubreportObject;

热门栏目