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...