cancel
Showing results for 
Search instead for 
Did you mean: 

Missing parameter values

Former Member
0 Kudos

Hello

We have a web application which uses Crystal reports 2008. This web application loads a report for the first time perfectly. This report expects one parameter and its being passed from the code (inside the OnInit Section). This report uses a storedprocedure to get data which expects a single parameter.

When the crystal viewer control is refreshed using the refresh button on the crystal tool bar it displays the error message "Missing parameter values".

Canu2019t figure out what we are doing wrong.

Any help in getting this sorted is really appreciated.

Thanks,

Sam

Code inside on Init--

crReportDocument = new SurveysByQuestionReport();

ConnectionInfo connectionInfo = new ConnectionInfo();

connectionInfo.ServerName = "xxx.xxx.xxx";

connectionInfo.DatabaseName = "xxxx";

connectionInfo.UserID = "xxxx";

connectionInfo.Password = "xxxxxxxx";

//Get the tables collection from the report object

crDatabase = crReportDocument.Database;

crTables = crDatabase.Tables;

//Apply the logon information to each table in the collection

foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)

{

crTableLogOnInfo = crTable.LogOnInfo;

crTableLogOnInfo.ConnectionInfo = connectionInfo;

crTable.ApplyLogOnInfo(crTableLogOnInfo);

}

//Once the connection to the database has been established for

//each table in the report, the report object can be bound to the viewer

//using the reportsource property of the viewer to display the report.

CrystalReportViewer1.ReportSource = crReportDocument;

//Get the collection of parameters from the report

crParameterFields = CrystalReportViewer1.ParameterFieldInfo;

//Access the specified parameter from the collection

crParameterField = crParameterFields["@PackageId"];

crParameterValues = crParameterField.CurrentValues;

crParameterValues.Clear();

//Set the current values for the parameter field

ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

crParameterDiscreteValue.Value = "07B9B1FE-5CF6-4C74-801F-536DA6615C7D";

//Add the first current value for the parameter field

crParameterValues.Add(crParameterDiscreteValue);

//Set the modified parameters collection back to the viewer so that

//the new parameter information can be used for the report.

CrystalReportViewer1.ParameterFieldInfo = crParameterFields;

base.OnInit(e);

Accepted Solutions (1)

Accepted Solutions (1)

former_member184995
Active Contributor
0 Kudos

HI Samitha,

Have you checked the viewer control and set the ReuseParameterValuesonRefresh to true? It is typically set to false by default.

Jason

Answers (0)