Quantcast
Channel: Crystal Reports
Viewing all articles
Browse latest Browse all 1507

missing parameter values in crystal reports asp.net c#

$
0
0

Please i am trying to export a report in pdf and that requires two parameter values "paraSessID" and "paraClassID". It worked perfectly on machine before i included connection for the report but now all i get is the "missing parameter values" on deployment.

Please help me out.

Below is the code:

// creating object of crystal report

ReportDocument crystalReport = new ReportDocument(); // creating object of crystal report
                    crystalReport.Load(Server.MapPath("~/termreport/first.rpt")); // path of report

                    // Once I have the data I need to apply it to the connection of the report
                    ConnectionInfo crConnection = new ConnectionInfo();
                    crConnection.UserID = "";
                    crConnection.ServerName = "";
                    crConnection.DatabaseName = "";
                    crConnection.Password = "";
                    
                    AssignConnectionInfo(crystalReport, crConnection);

                    crystalReport.SetDatabaseLogon(crConnection.UserID, crConnection.Password, crConnection.ServerName, crConnection.DatabaseName);
                    crystalReport.SetDataSource(dss.Tables[0].DefaultView); // binding dataset

                    ParameterFields paraField = new ParameterFields();
                    ParameterField paraSessID = new ParameterField();
                    ParameterField paraClassID = new ParameterField();
                    ParameterDiscreteValue paraSessDiscrete;
                    ParameterDiscreteValue paraClassDiscrete;

                    paraSessID.Name = "paraSessID";
                    paraSessID.CurrentValues.Clear();
                    paraSessDiscrete = new ParameterDiscreteValue();
                    paraSessDiscrete.Value = SessID;
                    paraSessID.CurrentValues.Add(paraSessDiscrete);
                    paraField.Add(paraSessID);

                    paraClassID.Name = "paraClassID";
                    paraClassID.CurrentValues.Clear();
                    paraClassDiscrete = new ParameterDiscreteValue();
                    paraClassDiscrete.Value = ClassID;
                    paraClassID.CurrentValues.Add(paraClassDiscrete);
                    paraField.Add(paraClassID);

                    CrystalReportViewer1.ParameterFieldInfo = paraField;

                    //crystalReport.SetParameterValue("paraSessID", SessID);
                    //crystalReport.SetParameterValue("paraClassID", ClassID);

                    CrystalReportViewer1.ReportSource = crystalReport;
                    //CrystalReportViewer1.RefreshReport();

                    crystalReport.ExportToHttpResponse
                    (CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "First Term Report");


Viewing all articles
Browse latest Browse all 1507

Trending Articles