473,769 Members | 4,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Settting Stored Procedure Parameters for VS2003 Crystal Reports

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.

No, I have to pass the parameters for the stored procedure. Can someone
tell me what is wrong with the code below? Can I pass these parameters
using the viewer of do I have to use the report document? If I have to use
the report doc how would I change this? I have spent more time on this than
any other problem in my entire career. Any help would be greatly
appreciated!!!

I recieve this error:

Exception Details: System.Argument OutOfRangeExcep tion: Specified argument
was out of the range of valid values.

Source Error:
Line 57:
Line 58: crParameterFiel ds = CrystalReportVi ewer1.Parameter FieldInfo;
Line 59: crParameterFiel d = crParameterFiel ds["@startyearpart "];
Line 60: crParameterValu es = crParameterFiel d.CurrentValues ;
Line 61: crParameterDisc reteValue = new ParameterDiscre teValue();
Here is my code:

using System;
using System.Collecti ons;
using System.Componen tModel;
using CrystalDecision s.CrystalReport s.Engine; //added
using CrystalDecision s.Shared; //added
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Sess ionState;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.H tmlControls;

namespace ptr
{
/// <summary>
/// Summary description for availToActualHo ursSP.
/// </summary>
public class availToActualHo ursSP : System.Web.UI.P age
{
protected CrystalDecision s.Web.CrystalRe portViewer CrystalReportVi ewer1;

//Crystal Report Variables
availToActualHo ursCR crReportDocumen t = new availToActualHo ursCR();

//'CrystalReport1 ' must be the name the CrystalReport
TableLogOnInfo crTableLogOnInf o = new TableLogOnInfo( );
ConnectionInfo crConnectionInf o = new ConnectionInfo( );

//Crystal Report Properties
CrystalDecision s.CrystalReport s.Engine.Databa se crDatabase;
CrystalDecision s.CrystalReport s.Engine.Tables crTables;
CrystalDecision s.CrystalReport s.Engine.Table crTable;

ParameterFields crParameterFiel ds;
ParameterField crParameterFiel d;
ParameterValues crParameterValu es;
ParameterDiscre teValue crParameterDisc reteValue;

private void Page_Load(objec t sender, System.EventArg s e)
{
crConnectionInf o.ServerName = "myserver";
crConnectionInf o.DatabaseName = "dbname";
crConnectionInf o.UserID = "sa";
crConnectionInf o.Password = "password";
crDatabase = crReportDocumen t.Database;
crTables = crDatabase.Tabl es;

foreach(Crystal Decisions.Cryst alReports.Engin e.Table crTable in crTables)
{
crTableLogOnInf o = crTable.LogOnIn fo;
crTableLogOnInf o.ConnectionInf o = crConnectionInf o;
crTable.ApplyLo gOnInfo(crTable LogOnInfo);
}

CrystalReportVi ewer1.ReportSou rce = crReportDocumen t;

//CODE RUNS AND DISPLAYS A REPORT WITHOUT THE PARAMETER CODE BELOW

crParameterFiel ds = CrystalReportVi ewer1.Parameter FieldInfo;
crParameterFiel d = crParameterFiel ds["@startyearpart "];
crParameterValu es = crParameterFiel d.CurrentValues ;
crParameterDisc reteValue = new ParameterDiscre teValue();
crParameterDisc reteValue.Value = 2003;
crParameterValu es.Add(crParame terDiscreteValu e);

crParameterFiel ds = CrystalReportVi ewer1.Parameter FieldInfo;
crParameterFiel d = crParameterFiel ds["@startmonthpar t"];
crParameterValu es = crParameterFiel d.CurrentValues ;
crParameterDisc reteValue = new ParameterDiscre teValue();
crParameterDisc reteValue.Value = 8;
crParameterValu es.Add(crParame terDiscreteValu e);
crParameterFiel ds = CrystalReportVi ewer1.Parameter FieldInfo;
crParameterFiel d = crParameterFiel ds["@endyearpa rt"];
crParameterValu es = crParameterFiel d.CurrentValues ;
crParameterDisc reteValue = new ParameterDiscre teValue();
crParameterDisc reteValue.Value = 2004;
crParameterValu es.Add(crParame terDiscreteValu e);

crParameterFiel ds = CrystalReportVi ewer1.Parameter FieldInfo;
crParameterFiel d = crParameterFiel ds["@endmonthp art"];
crParameterValu es = crParameterFiel d.CurrentValues ;
crParameterDisc reteValue = new ParameterDiscre teValue();
crParameterDisc reteValue.Value = 7;
crParameterValu es.Add(crParame terDiscreteValu e);

crParameterFiel ds = CrystalReportVi ewer1.Parameter FieldInfo;
crParameterFiel d = crParameterFiel ds["@ccntrs"];
crParameterValu es = crParameterFiel d.CurrentValues ;
crParameterDisc reteValue = new ParameterDiscre teValue();
crParameterDisc reteValue.Value = "55200,5530 0";
crParameterValu es.Add(crParame terDiscreteValu e);

//@startyearpart = 2003
//@startmonthpart = 8
//@endyearpart = 2004
//@endmonthpart = 7
//@ccntrs = '55200,55300'
}

#region Web Form Designer generated code
override protected void OnInit(EventArg s e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeCompo nent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.Load += new System.EventHan dler(this.Page_ Load);

}
#endregion
}
}
Nov 16 '05 #1
0 4898

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

Similar topics

0
4381
by: mmccor | last post by:
Hi. I'm having a problem passing a value to a sql stored procedure parameter in a crystal report. When I run a trace on Sql Server the parameters are empty or null. The procedure contains one varchar parameter. Current code is below. Using a Crystal 10 report. Any help would be greatly appreciated. Thanks.
0
403
by: Versteijn | last post by:
Hello all I want to define a crystal report and assign the stored procedure GetOpenQuestions() as it's datasource and provide a set of parameters. How does this work? My target situation is that I provide a server name, stored procedure name and it's parameters, and make crystal connect to the database itself. So I don't want to get the data myself and bind it to the report manually.
12
10411
by: Bill Nguyen | last post by:
What's the VB syntax to run the CR report using the following SP? I use CrystalreportViewer and ReportDocument. Thanks Bill Here's the SP in SQLserver 2K: CREATE proc mysp_ReportSubmission @salesdate as varchar(20),
0
2855
by: ZRexRider | last post by:
Hi, I've written reports based on stored procedures that receive parameters and it usually seems straight forward. Today I would like to use Crystal Reports parameter interface t prompt for a "Date Range" and then pass the lower and upper date values to the @StartDate and @EndDate of my SPROC's range. Unfortunately when I try to build a report off of a SPROC havng two
0
2156
by: Mariana | last post by:
Hello, I am exporting reports in pdf format from .net 2005 . The export is working fine; however the user values of stored procedure parameters does not show in the report. What do I need to do in order to see the parameters value in the report? The report has a report parameter "reportTitle" and i see the value in the report. It has also another 2 stored procedure parameters @BeginDate and @EndDate. The values are entered be the user;...
3
9923
by: LataChavan | last post by:
I have tried to look for a solution to the problem of sending parameters to stored procedures through crystal report. Following is the code: Now what happens is that if i do not apply the logon information the crystal reports works fine by accepting the parameter values and giving the Database Logon prompt when we run the report. But I would like to give the logon information at runtime. If I give the info at runtime the "stored procedure"...
2
7910
by: nguyenmiket | last post by:
I have created a crystal report in XI that uses a stored procedure with two date parameters. When i run it in Crystal reports it prompts me for the dates. When i put it in a view in a .aspx page, it fails with this message: Method 'IPromptingHTMLRenderOption_reserve10' on type 'CrystalDecisions.ReportAppServer.Prompting.PromptingHTMLRenderOptionClass' from assembly 'CrystalDecisions.ReportAppServer.Prompting, Version=11.0.3300.0,...
4
7091
by: yin_n_yang74 | last post by:
I am new to SQL and SQL Server world. There must be a simple solution to this, but I'm not seeing it. I am trying to create a crystal report (v8.5) using a stored procedure from SQL Server (v2000) in order to report from two databases and to enable parameters. When I create the stored procedure, it joins multiple one-to-many relationship tables. This results in repeated/duplicate records. Is this an issue that should be solved within...
1
1975
by: sreedivya | last post by:
Hi All I am trying to create crystal reports. In this concern i have created a command which execute a stored procedure. This stored procedure takes three parameters which in turn i want to pass it from .aspx page. when i click on button parameters should pass to that stored procedure. for example exec sp_example @date='{?selecteddate}' here date (varchar in stored procedure) and selected date (string type i selected) whenever i am...
0
9590
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
10223
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
10051
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...
1
10000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8879
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...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.