Solved

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

Posted on 2008-10-07
4
780 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 101

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

Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.

Question has a verified solution.

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

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

623 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