Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 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
 
Old July 18th, 2007, 09:28 AM
Registered User
 
Join Date: Jul 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Modifications in Appointment Booking System

I added two columns – roomsetup and avequip in the Appointment table with data type as nvarchar(256)
I have added both these in the wizard steps where the user will choose one value from dropdown. All works fine while booking an appointment. But, when I run the Appointment Details under the Management section, I get the following error

 System.IndexOutOfRangeException was unhandled by user code
  Message="roomsetup"
  Source="System.Data"
  StackTrace:
       at System.Data.ProviderBase.FieldNameLookup.GetOrdina l(String fieldName)
       at System.Data.SqlClient.SqlDataReader.GetOrdinal(Str ing name)
       at AppointmentManagerDB.GetAppointment(Int32 id) in C:\Documents and Settings\mt\My Documents\Visual Studio 2005\WebSites\ConferenceRoom\App_Code\DataAccess\A ppointmentManagerDB.vb:line 97
       at AppointmentManager.GetAppointment(Int32 id) in C:\Documents and Settings\mt\My Documents\Visual Studio 2005\WebSites\ConferenceRoom\App_Code\BusinessLogi c\AppointmentManager.vb:line 31
       at Management_AppointmentDetails.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\mt\My Documents\Visual Studio 2005\WebSites\ConferenceRoom\Management\Appointmen tDetails.aspx.vb:line 26
       at System.Web.UI.Control.OnLoad(EventArgs e)
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


In the Appointment managervb file (in data access folder under AppCode) where it says

Public Shared Function GetAppointment(ByVal id As Integer) As Appointment

I have added

myAppointment.roomsetup = myReader.GetValue(myReader.GetOrdinal("roomsetup") )
myAppointment.avequip = myReader.GetValue(myReader.GetOrdinal("avequip"))

and in the part for
Public Shared Function CreateAppointment(ByVal myAppointment As Appointment) As Boolean

I have added

  myCommand.Parameters.AddWithValue("@roomsetup", myAppointment.roomsetup)
  myCommand.Parameters.AddWithValue("@avequip", myAppointment.avequip)

I need help in resolving this. Please let me know what I am missing and /or doing wrong. Am a newbie...so assistance is greatly appreciated. Thanks...
 
Old July 18th, 2007, 10:12 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

The error message seems to suggest that you are not selecting the column roomsetup in the stored procedure that *selects* the data.

The code you modified for the Parameters collection is about saving the Appointment, not selecting it.

You probably need to add the required fields to sprocAppointmentSelectSIngleItem and SelectList as well.

Hope this helps,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old July 18th, 2007, 11:34 AM
Registered User
 
Join Date: Jul 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your response. I had added the following code in sProcAppointmentSelectSingleItem.....is it correct way of doing it?

myAppointment.roomsetup = myReader.GetValue(myReader.GetOrdinal("roomsetup") )
myAppointment.avequip = myReader.GetValue(myReader.GetOrdinal("avequip"))


I still get the same error message...where am i wrong?
 
Old July 18th, 2007, 11:37 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

No, it isn't The code you posted is not from the stored procedure; it's the code that reads the data returned by the stored procedure.

You need to change the select statement *in the database*.

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old July 18th, 2007, 11:49 AM
Registered User
 
Join Date: Jul 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry for the stupid questions...Thanks for spelling it out!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 10: Appointment Booking System shong BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 August 21st, 2008 04:04 AM
Chapter 10: Appointment Booking System shong BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 11 July 21st, 2008 01:38 PM
Appointment booking philblack1 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 January 25th, 2008 01:17 PM
Appointment Booking System newbie07 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 July 18th, 2007 08:32 AM
Modifications to Appointment Booking... mkumar BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 7 March 31st, 2007 01:51 AM





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