Using Stored Procedure, How do I set parameter in Crystal Reports .NET "Missing Parameter Values"
Posted on 2008-10-07
I've spent at least a day pulling my hair out on this one. I've searched many a forum for a solution. This issue seems fairly straight forward but I it seems that I'm missing something. I created a SPROC in SQL Server 2005 that expects a param of type string. I created a simple crystal report in VS 2008 (I tried using both a DataSet and OLE DB connection to the SPROC) and used the following code to set the param. I've tried various ways to implement this to no avail. By setting the 'EnablePrompt' property on the report viewer, I can type in a value and data is returned. Please provide some insight!
ReportDocument rd = new ReportDocument();
CrystalReportViewer1.ReportSource = rd;
ParameterFields pFS = CrystalReportViewer1.ParameterFieldInfo;
ParameterValues pVs = new ParameterValues();
ParameterDiscreateValue = pDV = new ParameterDiscreateValue();
pDV.Value = "someStringValue";
ParameterField pF = pFS["@someParam"];
pF.CurrentValues = pVs;