when I pass a string parameter &P1=text to Crystal Report viewer then the first prompt doesn't show, only the others and the report runs, as I want.. (see attached P1.jpg)
but when I send a date: &P2=01/01/12 the second parameter doesn't show, but when I click ok I am then prompted for the second parameter that I passed. (see attached P2a.jpg and P2b.jpg)
why are the passed dates being cleared and reprompted?
I use this URL:
http://127.0.0.1/MyReport/test.aspx?reportpath=test4.rpt&P2=01/01/2012
private void ReportViewer()
{
String reportFile = Request.QueryString.Get("reportpath");
CrystalReportViewer1.ReportSource = Server.MapPath(reportFile);
string userID = "crystal";
string password = "reports";
foreach (TableLogOnInfo boTableLogonInfo in CrystalReportViewer1.LogOnInfo)
{
ConnectionInfo boConnectionInfo = boTableLogonInfo.ConnectionInfo;
boConnectionInfo.UserID = userID;
boConnectionInfo.Password = password;
}
// pass parameters, prompt for needed ones
for (int i = 0; i < CrystalReportViewer1.ParameterFieldInfo.Count; i++)
{
if (string.IsNullOrEmpty(Request.QueryString.Get("P" + (i + 1))))
{
//do nothing this parameter is not passed
}
else
{
ParameterField paramField = CrystalReportViewer1.ParameterFieldInfo[i];
ParameterDiscreteValue ParamDiscreteValue = new ParameterDiscreteValue();
ParamDiscreteValue.Value = Request.QueryString.Get("P" + (i + 1));
paramField.CurrentValues.Add(ParamDiscreteValue);
}
}
}