castro05
08-06-2004, 07:48 AM
I have develop an aspnet page using vb code. I retrieving data from a sql server (2000). The problem is that I have two field on one of the table that are has null values and I getting the following error code
Cast from type 'DBNull' to type 'String' is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Cast from type 'DBNull' to type 'String' is not valid.
Source Error:
Line 54: '// So, to get the correct value, I simply subtract 1.
Line 55: EventDescription.Text = myDataReader.Item("EventDescription")
Line 56: EventStartTime.Text = myDataReader.item("EventStartTime")
Line 57: EventPhone.Text = myDataReader.Item("EventPhone")
Line 58:
Cast from type 'DBNull' to type 'String' is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Cast from type 'DBNull' to type 'String' is not valid.
Source Error:
Line 54: '// So, to get the correct value, I simply subtract 1.
Line 55: EventDescription.Text = myDataReader.Item("EventDescription")
Line 56: EventStartTime.Text = myDataReader.item("EventStartTime")
Line 57: EventPhone.Text = myDataReader.Item("EventPhone")
Line 58: