Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET 1.0
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 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 November 5th, 2003, 06:31 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default IndexOutOfRangeException - Chp 13, Page 446

Hi

The listed code in the book (Beginning ASP.NET.1.0 using VB.NET, Chp 13, Manipulating Data Sources, pp 446-447)

        Dim objRows() As DataRow

        objRows = objTable.Select("FirstName='Margaret' AND LastName='Peacock'")
        objRows(0).Item("FirstName") = "John"
        objRows(0).Item("LastName") = "Hatford"

        dgNameList3.DataSource = objTable.DefaultView
        dgNameList3.DataBind()

produces

Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.

Source Error:


Line 49:
Line 50: objRows = objTable.Select("FirstName='John' AND LastName='Hatford'")
Line 51: objRows(0).Item("FirstName") = "Margaret"
Line 52: objRows(0).Item("LastName") = "Peacock"
Line 53:

I cannot see anything in the erratum list regarding this but it does seem to of been an issue (the archive post had no solution listed).

Any ideas?

Thanks

  #2 (permalink)  
Old November 5th, 2003, 08:40 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I managed to resolve this by examining the database itself and seeing that the error was caused by the fact that

a) the record selected for amendment didn't exist
b) the suggested change for the record already existed as a current
   record

Once I changed the physical table record to mirror the search criteria i.e.

 objRows = objTable.Select("FirstName='Margaret' AND LastName='Peacock'")

the ASP.NET page performed as required.

Not the most helpful of error messages.

 


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
Chp.13 Parameter.SaveCurrentValue ??? studen77 BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 0 March 7th, 2007 04:18 PM
Page 446, first paragraph Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 0 June 16th, 2006 08:07 AM
Chapter 13 page 444 DRAYKKO Beginning VB 6 1 April 19th, 2006 07:10 PM



All times are GMT -4. The time now is 01:27 AM.


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