Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > BOOK: Beginning ASP.NET 1.0
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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.



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





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