我准备将数据库中的 一个表 id 大于 5 的记录检索出来,显示在在报表上。string queryChargeInfo = "select chargeInfoId, tenementName, from beforehandChargeInfo where chargeInfoId > 2";chargeInfoSqlConnection = new SqlConnection("Data Source=.;Integrated security=SSPI;Initial Catalog=fourMeterDb");
chargeInfoDataApter = new SqlDataAdapter(queryChargeInfo,chargeInfoSqlConnection);chargeInfoDataSet=new DataSet(); this.chargeInfoDataApter.Fill(this.chargeInfoDataSet,"Table");rptBeforehandChargeInfoList rpt =new rptBeforehandChargeInfoList();rpt.SetDataSource(chargeInfoDataSet);
this.crystalReportViewer1.ReportSource = rpt;********************然而,程序运行的结果所有的记录都显示(id 小于 3 的不应当显示的)对于搞过报表的朋友这应当不算啥。帮帮俺吧。
chargeInfoDataApter = new SqlDataAdapter(queryChargeInfo,chargeInfoSqlConnection);chargeInfoDataSet=new DataSet(); this.chargeInfoDataApter.Fill(this.chargeInfoDataSet,"Table");rptBeforehandChargeInfoList rpt =new rptBeforehandChargeInfoList();rpt.SetDataSource(chargeInfoDataSet);
this.crystalReportViewer1.ReportSource = rpt;********************然而,程序运行的结果所有的记录都显示(id 小于 3 的不应当显示的)对于搞过报表的朋友这应当不算啥。帮帮俺吧。
另:用存储过程返回数据集更好一些。速度也快.
另:用存储过程返回数据集更好一些。速度也快.*****************************我现在主要是测试着做,我的本意是 使用参数(让用户输入一个值),而 报表自带的帅选条件好象只能在 设计 阶段使用。