mfriedenthal
New member
- Joined
- Aug 18, 2005
- Messages
- 2
I have a VB.net app that stores data on SQL. I added a new field called "Status" to one of the SQL tables, of type bit, and created stored procedures to retrieve and edit the new field.
Everything works perfectly when the app is compiled in Debug mode.
However, when it is compiled in Release mode I get the following error:
System.IndexOutOfRangeException: Status
The code is executed OnLoad:
The stack looks like:
System.IndexOutOfRangeException: Status
at System.Data.Common.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at System.Data.SqlClient.SqlDataReader.get_Item(String name)
at MyApp.Utilities.MyMethod()
Can anyone suggest a solution, or at least, how to go about tracking down the source of the error?
Thank you.
Everything works perfectly when the app is compiled in Debug mode.
However, when it is compiled in Release mode I get the following error:
System.IndexOutOfRangeException: Status
The code is executed OnLoad:
Code:
Try
MyAppConnection.Open()
MyAppSQLCommand.Connection = MyAppConnection
drResults = MyAppSQLCommand.ExecuteReader
While drResults.Read
If drResults("Status") Then
Status = "Active"
Else
Status = "Not Active"
End If
liIndex = New ListItem(drResults("Name").ToString() & " - " & Status, drResults("I_ID").ToString)
ddlInspectors().Items.Add(liIndex)
End While
drResults.Close()
Catch ex As Exception
RecordError(ex.ToString)
Finally...
The stack looks like:
System.IndexOutOfRangeException: Status
at System.Data.Common.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at System.Data.SqlClient.SqlDataReader.get_Item(String name)
at MyApp.Utilities.MyMethod()
Can anyone suggest a solution, or at least, how to go about tracking down the source of the error?
Thank you.