Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 13th, 2006, 12:00 PM
Authorized User
 
Join Date: Oct 2004
Location: , , .
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Crystal reports error : Index was out of range.

I am trying to running a crystal report 8.0 in .NET C# based on a Oracle stored procedure that accepts two parameters. I get this error "Index
was out of range. Must be non-negative and less than the size of the
collection. Parameter name: index" on the line: crParameterField1 =
CrystalReportViewer3.ParameterFieldInfo[0];.
Here is my code:

protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer3;
OracleReport3 crReportDocument = new OracleReport3();

TableLogOnInfo crTableLogOnInfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();

//Crystal Report Properties
protected CrystalDecisions.CrystalReports.Engine.Database crDatabase;
protected CrystalDecisions.CrystalReports.Engine.Tables crTables;
protected ParameterFields crParameterFields;
protected ParameterField crParameterField1;
protected ParameterField crParameterField2;
protected ParameterValues crParameterValues;
protected ParameterDiscreteValue crParameterDiscreteValue1;
protected ParameterDiscreteValue crParameterDiscreteValue2;

private void Page_Load(object sender, System.EventArgs e)
{
string empid, perm;
empid = (string)Session["empid"];
perm = (string)Session["perm"];
crConnectionInfo.UserID = "userid";
crConnectionInfo.Password = "password";
crDatabase = crReportDocument.Database;
crTables = crDatabase.Tables;

foreach(CrystalDecisions.CrystalReports.Engine.Tab le crTable in crTables)
            {
                crTableLogOnInfo = crTable.LogOnInfo;
                crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
                crTable.ApplyLogOnInfo(crTableLogOnInfo);
            }

CrystalReportViewer3.ReportSource= crReportDocument;
crParameterField1 = CrystalReportViewer3.ParameterFieldInfo[0];
crParameterField2 = CrystalReportViewer3.ParameterFieldInfo[1];
crParameterDiscreteValue1 = new ParameterDiscreteValue();
crParameterDiscreteValue2 = new ParameterDiscreteValue();
crParameterDiscreteValue1.Value = "emp_id";
crParameterDiscreteValue2.Value = "emp_perm";
crParameterField1.CurrentValues.Add(empid);
crParameterField2.CurrentValues.Add(perm);
        }

Can someone please help?

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Index was out of range. Must be non-negative raghavendra_das ASP.NET 2.0 Professional 0 July 24th, 2008 08:16 AM
index out of range datagrid muchengeti ASP.NET 2.0 Professional 0 April 21st, 2006 12:43 PM
Index Out of range exception PbsiGuru General .NET 3 March 22nd, 2004 10:04 AM



All times are GMT -4. The time now is 05:06 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.