关于水晶报表问题,请高手帮忙解决???
我在做一个水晶报表,在页眉建了一个文本框,我想通过赋值方式,改变文件框内容,但是其中CrystalReportSource1.ReportDocument.ParameterFields["fxdm2"].CurrentValues.AddValue("汇总");[/u]这一行老提示”未将对象引用设置到对象的实例。”
不知道是什么原因,请高手指教帮忙。附部分源程序
SqlConnection sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
String sql = "select bknf as bknf,kslxdm as kslxdm,sjh as sjh,kmmc as kmmc,sum(sjs) as sjs,sum(zf) as zf,sum(fhs) as fhs from fxbkzk where bknf like '" + DropDownList1.SelectedValue + "' and kslxdm like '" + this.DropDownList2.SelectedValue + "' and fxdm like'" + this.DropDownList3.SelectedValue + "' group by bknf,kslxdm,sjh,kmmc order by bknf,kslxdm,sjh,kmmc";
DataSet ds = new DataSet();
SqlCommand sqlCmd = new SqlCommand(sql, sqlCon);
SqlDataAdapter sqlAd = new SqlDataAdapter();
sqlAd.SelectCommand = sqlCmd;
sqlAd.Fill(ds, "sql");
CrystalReportSource1.ReportDocument.Load(Server.MapPath("../print/CR_fxbktj.rpt"));
//注意此处必需指明Dataset中的表的名称,否则会提示“您请求的报表需要更多信息.”
//CR_fxbktj.ReportDocument.SetDataSource(ds.Tables["sql"]);
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
//{?}中的参数可以不用赋值,即使赋了值也不起作用。
CrystalReportSource1.ReportDocument.ParameterFields["fxdm2"].CurrentValues.AddValue("汇总");这一行老提示”未将对象引用设置到对象的实例。”
CrystalReportSource1.DataBind();
CrystalReportViewer1.ReportSource = CrystalReportSource1;
CrystalReportViewer1.DataBind();
补充:.NET技术 , ASP.NET