Could someone shed some light on this issue. I have created a Crystal Report using Version 13 in Visual Studion 2010. I have the report bound to a stored procedure. When I click on the "Main Report Preview" button I am prompted to fill in the agr's. If I fill them in I will be able to see all the data (8 pages), page through the data etc and the report looks great. If I save the report after doing what I just described and then try to call the report at runtime by creating discreate parameters, the report will only display for the arg's that I used during the design time Preview. If I go back into the report and click 'Verify database' and then just set the arg's to Null and save the report, I will be able to run my web app and fill in the args with dynamic info and the report displays the first page just fine ie: 1 of 8 pages. If I try to move to the next page the report goes blank.
Would anyone know what's causing this? How should I be developing the reports, so that I can call them with dynamic arguments.
Here is how I am calling the report at design time.
string rptname = (string)Request.QueryString["rptname"]; CrystalDecisions.CrystalReports.Engine.ReportDocument myReportdoc; myReportdoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); ConnectionInfo conn = new ConnectionInfo(); // Connection info conn.DatabaseName = ConfigurationManager.AppSettings["database"]; conn.UserID = ConfigurationManager.AppSettings["userid"]; conn.Password = ConfigurationManager.AppSettings["password"]; // Report Fields. string rptPath = (string)Server.MapPath(rptname); rptPath = rptPath.Replace(rptname, "Reports\\" + rptname); myReportdoc.Load(rptPath); CrystalReportViewer1.ReportSource = myReportdoc;
string custid = (string)Request.QueryString["custid"]; string active = (string)Request.QueryString["active"];
string agedate = (string)Request.QueryString["agedate"]; ParameterField pfcustid = CrystalReportViewer1.ParameterFieldInfo[0]; ParameterField pfactive = CrystalReportViewer1.ParameterFieldInfo[1]; ParameterField pfagedate = CrystalReportViewer1.ParameterFieldInfo[2]; ParameterDiscreteValue dv0 = new ParameterDiscreteValue(); ParameterDiscreteValue dv1 = new ParameterDiscreteValue(); ParameterDiscreteValue dv2 = new ParameterDiscreteValue(); dv0.Value = custid; dv1.Value = active; dv2.Value = agedate; pfcustid.CurrentValues.Add(dv0); pfactive.CurrentValues.Add(dv1); pfagedate.CurrentValues.Add(dv2);
TableLogOnInfos LogOninfos = CrystalReportViewer1.LogOnInfo; foreach (TableLogOnInfo LogOnInfo in LogOninfos) { LogOnInfo.ConnectionInfo = conn; }
Note: I have stepped through my code on the page that I call with the CrystalReport Viewer and the code is hit each time I page, it's just that nothing display on the page.
Thanks
Dave.