Solved

Using Stored Procedure, How do I set parameter in Crystal Reports .NET "Missing Parameter Values"

Posted on 2008-10-07
4
774 Views
Last Modified: 2013-12-17
Hello all,

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();
rd.load(Server.MapPath("some path");
CrystalReportViewer1.ReportSource = rd;
ParameterFields pFS = CrystalReportViewer1.ParameterFieldInfo;
ParameterValues pVs = new ParameterValues();
ParameterDiscreateValue = pDV = new ParameterDiscreateValue();
pDV.Value = "someStringValue";
pVs.Add(pDV);
ParameterField pF = pFS["@someParam"];
pF.CurrentValues = pVs;
CrystalReportViewer1.DataBind();



0
Comment
Question by:cUnSharp
4 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
ID: 22660482
0
 
LVL 18

Assisted Solution

by:UnifiedIS
UnifiedIS earned 250 total points
ID: 22660629
I run my reports with a loop that compares the parameter name with stored values in a database.  You should be able to tweak to fit.

ReportDocument rd = new ReportDocument();
rd.load(Server.MapPath("some path");
 
ParameterFields pFS = rd.ParameterFields
ParameterValues pVs = ParameterValues();
ParameterField pF
for each pF in pFS
          if pF.Name = "SomeParameterName" Then
                   pVS = pFS.CurrentValues
                   ParameterDiscreateValue pDV = new ParameterDiscreteValue();
                   pDV.Value = "SomeValue"
                   pVS.Add(pDV)
           endif
next
CrystalReportViewer1.ReportSource = rd;
'Not sure if you need the bind, I only set the report source
'CrystalReportViewer1.DataBind();

Open in new window

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How useful is the free version of Selenium? 3 32
start a process from a service 3 22
Possibly a grouping issue? 7 21
Call Controller Action Method from ASPX 2 13
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question