Data Connectivity
 Crystal Reports Forum : Crystal Reports .NET 2003 : Data Connectivity
Message Icon Topic: Exception Details: System.ArgumentOutOfRangeExcept Post Reply Post New Topic
Author Message
dugfmjamul
Newbie
Newbie
Avatar

Joined: 07 Aug 2007
Location: United States
Online Status: Offline
Posts: 9
Quote dugfmjamul Replybullet Topic: Exception Details: System.ArgumentOutOfRangeExcept
    Posted: 22 Aug 2007 at 1:07pm

Crystal Reports for .NET users,

 

Does any know the why the following error is displayed?

 

Error breaks on pf = pfs["@Country"] :

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.

Source Error:


Line 96:    ParameterDiscreteValue spValue;   
Line 97:    pfs = crv1.ParameterFieldInfo; 
Line 98:    pf = pfs["@Country"];
Line 99:    spValue = new ParameterDiscreteValue();
Line 100:   spValue.Value = cboCountry.SelectedItem.Text;
 
Code:

crv1.ReportSource = (ReportDocument)Session["REPORT"];
crv1.LogOnInfo = new TableLogOnInfos();
TableLogOnInfo MyLogonInfo = new TableLogOnInfo();
MyLogonInfo.TableName = "up_Customers;1";
MyLogonInfo.ConnectionInfo.DatabaseName = "xtreme";
MyLogonInfo.ConnectionInfo.ServerName = "SVRNAME";
MyLogonInfo.ConnectionInfo.UserID="User1";
MyLogonInfo.ConnectionInfo.Password="Pa$$word1";
crv1.LogOnInfo.Add(MyLogonInfo);
ParameterFields pfs;
IParameterField pf;
ParameterDiscreteValue spValue;   
pfs = crv1.ParameterFieldInfo; 
pf = pfs["@Country"];
spValue = new ParameterDiscreteValue();
spValue.Value = cboCountry.SelectedItem.Text;
pf.CurrentValues.Add(spValue);
Session["REPORT"] = rpt;

 

Report based on the following SQL Command:


DECLARE @RC int
DECLARE @Country varchar(50)
SET @Country = 'USA'
EXEC @RC = [xtreme].[dbo].[up_Customers] @Country

 

Stored Procedure on SQL Server xtreme database:

ALTER  PROCEDURE up_Customers
@Country varchar(50)
AS
SELECT [Customer Name],Address1,City,Region,Country,[Postal Code],Phone
FROM Customer
WHERE Country = @Country
ORDER BY Country, Region, [Customer Name]

 

Any help would be greatly appreciated, thanks in advance.

 

dugfmjamul

 

 

dugfmjamul
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 22 Aug 2007 at 1:48pm
Take the "@" out of the parameter name and see if that works.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
dugfmjamul
Newbie
Newbie
Avatar

Joined: 07 Aug 2007
Location: United States
Online Status: Offline
Posts: 9
Quote dugfmjamul Replybullet Posted: 22 Aug 2007 at 2:35pm

Brian,

Thanks for the quick response time and no, it does not work. I still get the following error.

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.

Source Error:

Line 94: crv1.LogOnInfo.Add(MyLogonInfo);
Line 95: ParameterFields pfs = crv1.ParameterFieldInfo; 
Line 96: IParameterField pf = pfs["Country"];
Line 97: ParameterDiscreteValue spValue;    
Line 98: spValue = new ParameterDiscreteValue();

Code:

ReportDocument newRpt = (ReportDocument)Session["REPORT"];
crv1.ReportSource = newRpt; 
crv1.LogOnInfo = new TableLogOnInfos();
TableLogOnInfo MyLogonInfo = new TableLogOnInfo();
MyLogonInfo.TableName = "up_Customers;1";
MyLogonInfo.ConnectionInfo.DatabaseName = "xtreme";
MyLogonInfo.ConnectionInfo.ServerName = "SERVERNAME";
MyLogonInfo.ConnectionInfo.UserID="user";
MyLogonInfo.ConnectionInfo.Password="Password1";
crv1.LogOnInfo.Add(MyLogonInfo);
ParameterFields pfs = crv1.ParameterFieldInfo; 
IParameterField pf = pfs["Country"];
ParameterDiscreteValue spValue;    
spValue = new ParameterDiscreteValue();
spValue.Value = cboCountry.SelectedItem.Text;
pf.CurrentValues.Add(spValue);
Session["REPORT"] = newRpt;

Visual Studio 2003 Debugger:

-crv1.ParameterFieldInfo {CrystalDecisions.Shared.ParameterFields} CrystalDecisions.Shared.ParameterFields
 System.Collections.ArrayList {Count=0} System.Collections.ArrayList
 Item <cannot view indexed property> CrystalDecisions.Shared.ParameterField
 Item <cannot view indexed property> CrystalDecisions.Shared.ParameterField
 Item <cannot view indexed property> CrystalDecisions.Shared.ParameterField
 pf <undefined value> CrystalDecisions.Shared.IParameterField

Notes:
1. As you can see, the CrystalReportsViewer does not list any parameters
2. When I create a parameter in ANY Report document the Enter Parameter Values prompt window does not appear when the report is loaded to select parameter values.
3.  The IParameterField reflects the CrystalReports parameter not the SQL parameter, is that correct?

Once again thanks for your help,
dugfmjamul

 

 

dugfmjamul
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.030 seconds.