473,978 Members | 30,241 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting parameters on Crystal Report - Urgent

Hi,

I've got a Crystal Report that gets some data from a stored procedure and I
need to set some params of the proc at runtime.
But no matter what I do, I cannot get the report to eat the params - it
keeps showing an error that the proc needs to have it's params initialized.

Code's something like:

ConnectionInfo ci = new ConnectionInfo( );
ci.ServerName = sqlServer;
ci.DatabaseName = sqlDatabase;
ci.UserID = sqlUser;
ci.Password = sqlPassword;

TableLogOnInfo ti = new TableLogOnInfo( );
ti.ConnectionIn fo = ci;

ReportDocument doc = new ReportDocument( );
doc.Load(report Doc); // Some .rpt file
doc.SetDatabase Logon(sqlUser, sqlPassword);

foreach(Table t in doc.Database.Ta bles)
{
t.ApplyLogOnInf o(ti);
if(!t.TestConne ctivity())
{
return -2;
}
}

ParameterFieldD efinitions pfds = doc.DataDefinit ion.ParameterFi elds;
for(int i = 0; i < 3; i++)
{
string name = "";
string value = "";

switch(i)
{
case 0:
name = "@ItemName" ;
value = "ZZZZZ";
break;
case 1:
name = "@ItemCount ";
value = "10";
break;
case 2:
name = "@ItemOptio n";
value = "0";
break;
}

ParameterDiscre teValue pdv = new ParameterDiscre teValue();
pdv.Value = value;

ParameterValues pvs = new ParameterValues ();
pvs.Add(pdv);

ParameterFieldD efinition pfd = pfds[name];
pfd.ApplyCurren tValues(pvs);
}

_reportViewer.R eportSource = doc;

Running through the params before setting the report on the viewer tells me
that all params has a current value!
Where am I getting wrong, or what am I missing to do ??

Thanks in advance

Soren

Feb 6 '06 #1
1 4258
Hi,
I always use ReportDocument. SetParameterVal ue( "ParameterN ame" ,
par_value );

I have never have any problem with it.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Soren S. Jorgensen" <no****@nodomai n.com> wrote in message
news:ON******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

I've got a Crystal Report that gets some data from a stored procedure and
I need to set some params of the proc at runtime.
But no matter what I do, I cannot get the report to eat the params - it
keeps showing an error that the proc needs to have it's params
initialized.

Code's something like:

ConnectionInfo ci = new ConnectionInfo( );
ci.ServerName = sqlServer;
ci.DatabaseName = sqlDatabase;
ci.UserID = sqlUser;
ci.Password = sqlPassword;

TableLogOnInfo ti = new TableLogOnInfo( );
ti.ConnectionIn fo = ci;

ReportDocument doc = new ReportDocument( );
doc.Load(report Doc); // Some .rpt file
doc.SetDatabase Logon(sqlUser, sqlPassword);

foreach(Table t in doc.Database.Ta bles)
{
t.ApplyLogOnInf o(ti);
if(!t.TestConne ctivity())
{
return -2;
}
}

ParameterFieldD efinitions pfds = doc.DataDefinit ion.ParameterFi elds;
for(int i = 0; i < 3; i++)
{
string name = "";
string value = "";

switch(i)
{
case 0:
name = "@ItemName" ;
value = "ZZZZZ";
break;
case 1:
name = "@ItemCount ";
value = "10";
break;
case 2:
name = "@ItemOptio n";
value = "0";
break;
}

ParameterDiscre teValue pdv = new ParameterDiscre teValue();
pdv.Value = value;

ParameterValues pvs = new ParameterValues ();
pvs.Add(pdv);

ParameterFieldD efinition pfd = pfds[name];
pfd.ApplyCurren tValues(pvs);
}

_reportViewer.R eportSource = doc;

Running through the params before setting the report on the viewer tells
me that all params has a current value!
Where am I getting wrong, or what am I missing to do ??

Thanks in advance

Soren

Feb 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1216
by: murl | last post by:
I have created a crystal report using crystal9.0, that is linked to a stored procedure in sql2k which requires 2 parameters to be met, a beggining date(smalldatetime) and a endingdate(smalldatetime). In crystal the report works fine after the parameters are met, but when loading the report into my c# app using the crystal report viewer, it asks for the parameters but does not show the report after they are met. The viewer shows up but no...
0
1537
by: murl | last post by:
I have built a crystal report using crystal9.0 that is linked to a stored procedure built in sql2k, which requires 2 parameters beginningdate(smalldatetime),and endingdate(smalldatetime). When the parameters are met in crystal the report shows up correctly with no problems, but when the report is displayed using the crsyatal report viewer in my c# app, the report is not displayed at all after crystal prompts for the parameters. The viewer...
0
4906
by: Craig Faulkner | last post by:
I have been fighting through my first crystal report in VS2003.NET and have made some headway. Here is what I've done: 1. Created a crystal report in VS2003 from a SQL stored procedure with parameters through the GUI. 2. Finally got past the logon failure error to display the report using the viewer. I assume that default parameters are being used since it does display some data and the SP won't run without being passed some values.
0
8799
by: stephan | last post by:
I know that this has been beaten to death but I can't seem to resolve my issues (I have 2 of them). I have created a class that exposes a public method which returns a datatable as a datasource for a Crystal Report. The method has a single argument which represents a parameter required by the Stored Procedure. When I generate the report in Crystal and run it using the class I built, it works fine. I've tried it with parameters and...
2
2731
by: Chris | last post by:
Hi, I'm new to ASP.Net and Crystal but I've been playing with some samples and have run into a problem. If I put all my code into the Page_Init sub of a single form and run that form, the Crystal report runs fine. Now i am trying to create another web form where I can input parameters, hit submit and have those parameters passed to the second
10
2361
by: Adis | last post by:
Asp.Net Visual Studio 2003 SQL Server. Hi, Obtaining Data Based Upon Multiple Selections From a ListBox... I have database in Sqlserver and ListBox (Multiple Selection Mode) in my Visual Studio Webform. I wish obtain various records from My_Store_Procedure
3
5254
by: Diggler | last post by:
I was working on a report that is populated with three different tables in a strongly-typed dataset. The tables are populated from custom objects rather than directly from SQL Server. I loop through the objects and add the rows one at a time. I then push the dataset to the Crystal Report. The report worked fine, until this morning. I added another field or two to the dataset, and rearranged the report fields to organize the report...
3
2418
by: lodatokab | last post by:
I'm have problem to run crystal report (VS 2005) on my computer with Windows 2000 Server. I run the solution in my dev envroiment (Windows XP) and no problems. When I try to run in on IIS 5.0 on Windows 2000 Server I got the following error: Compiler Error Message: CS0433: The type 'CrystalDecisions.Shared.ExportOptions' exists in both ...
3
1833
by: GaryDean | last post by:
This is really a licence question.... I want to deploy the version of Crystal Reports that comes with Visual Studio 2005 to a production server. Is there another license charge if the I'm licensed on the production server to run Visual Studio? -- Regards, Gary Blakely
0
10356
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10172
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11413
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8464
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7617
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.