Solved

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

Posted on 2008-10-07
4
768 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
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 video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now