B
Brad Isaacs
I am using ASP.NET 2.0 codebehind Visual Basic, Visual Studio 2005
Working with DataSet creating a Data Access Layer via VS 2005.
My error is when the code that is prewritten by VS 2005 Casts to String but
the data inside the column is a NULL.
Code prewritten by visual studio:
<System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property SuiteFloor() As String
Get
Try
Return CType(Me(Me.tableaspnet_getMyInfo.SuiteFloorColumn),String)
Catch e As System.InvalidCastException
Throw New System.Data.StrongTypingException("The value for column
'SuiteFloor' in table 'aspnet_getMyInfo' is DBNull.", e)
End Try
End Get
Set
Me(Me.tableaspnet_getMyInfo.SuiteFloorColumn) = value
End Set
End Property
It throws an error becuase the value in the database is NULL.
{"The value for column 'SuiteFloor' in table 'aspnet_getMyInfo' is DBNull."}
I tried to perform this code in my .aspx page:
Public Sub populateMyInfoData(ByVal orgID As String)
Dim MyInfoDataAdapter As New
dsMyInfoTableAdapters.aspnet_getMyInfoDataTableAdapter
Dim MyInfoData As dsMyInfo.aspnet_getMyInfoDataDataTable
Dim cc As dsMyInfo.aspnet_getCrownCorpDataRow
MyInfoData = crownDataAdapter.GetData_ByorgIDLanguageID(languageID, orgID)
For Each cc In MyInfoData
'Response.Write("Suite/Floor: " & cc.SuiteFloor & "<br>")
'Response.Write("Street Address: " & cc.StreetAddress & "<br>")
'On all fields below,
'Check that the field does not contain a NULL value
'SuiteFloor
If IsDBNull(cc.SuiteFloor) Then
txtSuiteFloor.Text = ""
Else
txtSuiteFloor.Text = cc.SuiteFloor
End If
This had no affect because the error is THROWN when inside the Property
method.
Does anyone have any ideas how to resolve this issue?
Thanks in advance,
~Brad
Working with DataSet creating a Data Access Layer via VS 2005.
My error is when the code that is prewritten by VS 2005 Casts to String but
the data inside the column is a NULL.
Code prewritten by visual studio:
<System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property SuiteFloor() As String
Get
Try
Return CType(Me(Me.tableaspnet_getMyInfo.SuiteFloorColumn),String)
Catch e As System.InvalidCastException
Throw New System.Data.StrongTypingException("The value for column
'SuiteFloor' in table 'aspnet_getMyInfo' is DBNull.", e)
End Try
End Get
Set
Me(Me.tableaspnet_getMyInfo.SuiteFloorColumn) = value
End Set
End Property
It throws an error becuase the value in the database is NULL.
{"The value for column 'SuiteFloor' in table 'aspnet_getMyInfo' is DBNull."}
I tried to perform this code in my .aspx page:
Public Sub populateMyInfoData(ByVal orgID As String)
Dim MyInfoDataAdapter As New
dsMyInfoTableAdapters.aspnet_getMyInfoDataTableAdapter
Dim MyInfoData As dsMyInfo.aspnet_getMyInfoDataDataTable
Dim cc As dsMyInfo.aspnet_getCrownCorpDataRow
MyInfoData = crownDataAdapter.GetData_ByorgIDLanguageID(languageID, orgID)
For Each cc In MyInfoData
'Response.Write("Suite/Floor: " & cc.SuiteFloor & "<br>")
'Response.Write("Street Address: " & cc.StreetAddress & "<br>")
'On all fields below,
'Check that the field does not contain a NULL value
'SuiteFloor
If IsDBNull(cc.SuiteFloor) Then
txtSuiteFloor.Text = ""
Else
txtSuiteFloor.Text = cc.SuiteFloor
End If
This had no affect because the error is THROWN when inside the Property
method.
Does anyone have any ideas how to resolve this issue?
Thanks in advance,
~Brad