Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 24th, 2010, 02:31 PM
Authorized User
Join Date: Mar 2010
Posts: 65
Thanks: 6
Thanked 0 Times in 0 Posts
Default IndexOutofRange Exception occurs in ASP 3.5

Hello,(Thanks for your time)

I'm getting the following runtime error message:


Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: RowId

Source Error:

Line 125: pid = Convert.ToInt32(reader["RowId"]);

Stack Trace:

[IndexOutOfRangeException: RowId]

I get this error sometimes,But sometimes it works fine.

I have checked all the columns in the select statement, it contains RowID.

-i dont know where it went wrong.

me select statemet:

SELECT F.RowId, F.PredictionTopic, F.Memlgname, F.MemPrediction, F.UknowY,F.PredictedDate, C.Memvote, C.MemComments, C.CommUserName, C.CommentedDate FROM Forumtable
AS F LEFT OUTER JOIN CommentTable AS C ON F.RowId = C.RowId ORDER BY F.PredictedDate desc

-Appreciate your help

  #2 (permalink)  
Old August 24th, 2010, 04:35 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

I think you need to supply more information and code. AFAIK, the IndexOutOfRange exception could only occur when the column is missing. Maybe the SQL is dynamic and in some cases the column is indeed missing? Or maybe you get multiple result sets back?

Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #3 (permalink)  
Old August 25th, 2010, 01:08 AM
Registered User
Points: 18, Level: 1
Points: 18, Level: 1 Points: 18, Level: 1 Points: 18, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default RE:

Is this piece of code is in loop. Check the boundary condition , there might be chances that while execution of the above statement it was going out of boundary.

could you please put full code of your function.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Need to Log When Edit Occurs in Gridview JB4375 BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 0 April 15th, 2009 10:10 AM
DataList DataBinding Error: IndexOutOfRange AnotherAspdotnetDeveloper ASP.NET 2.0 Professional 0 February 20th, 2007 05:51 AM
How to handle error or exception if it occurs popoxinhxan BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 August 27th, 2006 06:44 PM
urgent: session timeout occurs unexpectedly seemagaur ASP.NET 1.0 and 1.1 Basics 0 October 10th, 2005 12:59 PM
How to know when an exception occurs? ecobo C# 2 December 30th, 2004 04:05 AM

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

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