Crystal Reports会一直提示参数
我在.net 4.0的水晶报告2010中遇到了一个可怕的问题(我使用的是固定的13.0.1版本,但是发布了13.0.4)。 无论我尝试哪种方式,我总是会得到一个提示对话框,以便第一次输入我的一个参数值。
CrystalReportViewer1.ReportSource = CustomerReport1; CustomerReport1.Database.Tables[0].SetDatasource ( this.dataset); CustomerReport1.SetParameterValue("PathLocation", Location.Text); CustomerReport1.Parameter_PathLocation.CurrentValues.Add(Location.Text) // to be safe using CS 2010 for .net 4 CrystalReportViewer1.ReuseReportParametersOnRefresh = true; // to prevent from showing again and again.
我也试过这个:
CustomerReport1.Database.Tables[0].SetDatasource ( this.dataset); CustomerReport1.SetParameterValue("PathLocation", Location.Text); CrystalReportViewer1.ReportSource = CustomerReport1;
还有这个:
CustomerReport1.Database.Tables[0].SetDatasource ( this.dataset); CustomerReport1.Parameter_PathLocation.CurrentValues.Add(Location.Text) CrystalReportViewer1.ReportSource = CustomerReport1; // the parameter in the report has Optional Parameter = false, Static , Multiple Value = false .
有人可以帮忙吗? 我对此感到沮丧。 它在以前的版本中有效,但现在我收到了这个提示框。
谢谢。
终于找到了解决方案。 如果我们在ParameterValue
之后设置DataSource
,则不会提示。
因此,如果我们将它们按此顺序排列,那么任何人都会工作
// First, call SetParameterValue. Then, call SetDatasource. CustomerReport1.SetParameterValue("PathLocation", Location.Text); CustomerReport1.Database.Tables[0].SetDatasource(this.dataset); CrystalReportViewer1.ReportSource = CustomerReport1;
谢谢你们。
创建参数但不使用选择公式 – >记录为其分配公式。 通过创建文本框,标签和按钮,从vb或c#.net IDE应用此参数。 将选择公式放在单击按钮过程上。