Bill Crawley
May 23rd, 2008, 02:43 AM
Hi All,
I have a column on an SQL Server DB that is declared as type integer and is nullable.
I have a query that includes this column that is bound to a typed dataset.
This is the Typed Dataset's Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property RateableValue() As Integer
Get
Try
Return CType(Me(Me.tableCustomerSystemFieldsAssetLocation.RateableValueColumn), Integer)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'RateableValue' in table 'CustomerSystemFieldsAssetLocation'" & _
" is DBNull.", e)
End Try
End Get
Set(ByVal value As Integer)
Me(Me.tableCustomerSystemFieldsAssetLocation.RateableValueColumn) = value
End Set
End Property
How do I test for a null value against this or should I change the code above. As soon as It hits the row:
Return CType(Me(Me.tableCustomerSystemFieldsAssetLocation.RateableValueColumn), Integer)
My app crashes with conversion error DBnull to integer.
I have a column on an SQL Server DB that is declared as type integer and is nullable.
I have a query that includes this column that is bound to a typed dataset.
This is the Typed Dataset's Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property RateableValue() As Integer
Get
Try
Return CType(Me(Me.tableCustomerSystemFieldsAssetLocation.RateableValueColumn), Integer)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'RateableValue' in table 'CustomerSystemFieldsAssetLocation'" & _
" is DBNull.", e)
End Try
End Get
Set(ByVal value As Integer)
Me(Me.tableCustomerSystemFieldsAssetLocation.RateableValueColumn) = value
End Set
End Property
How do I test for a null value against this or should I change the code above. As soon as It hits the row:
Return CType(Me(Me.tableCustomerSystemFieldsAssetLocation.RateableValueColumn), Integer)
My app crashes with conversion error DBnull to integer.