Crystal Reports不断提示输入参数 [英] Crystal Reports keeps prompting for Parameter
问题描述
我有一个可怕的问题,水晶报告2010年的.net 4.0(我使用固定的13.0.1版本,但13.0.4发布)。无论以哪种方式尝试,我总是得到一个提示对话框,以第一次输入我的一个参数值。
I am having a terrible problem with crystal report 2010 for .net 4.0 (I am using the fixed 13.0.1 version but 13.0.4 is released). No matter which way I try, I am always getting a prompting dialogue box to input my one parameter value the first time.
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 .
任何人都可以帮忙吗?我对此感到沮丧。它在以前的版本中工作,但现在我得到这个提示框。
Can anyone please help? I am getting frustrated with this. It worked in previous versions, but now I am getting this prompt box.
谢谢。
推荐答案
终于找到了解决方案。如果我们在 ParameterValue
之后设置 DataSource
,则不会提示。
Finally found the solution. It doesn't prompt if we set the DataSource
after the ParameterValue
.
所以任何人都会工作,如果我们按顺序:
So anyone of those will work if we put them in this order:
// First, call SetParameterValue. Then, call SetDatasource.
CustomerReport1.SetParameterValue("PathLocation", Location.Text);
CustomerReport1.Database.Tables[0].SetDatasource(this.dataset);
CrystalReportViewer1.ReportSource = CustomerReport1;
谢谢大家。
这篇关于Crystal Reports不断提示输入参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!