M
MU
I have a Datatable that I am assigning the values of the row to
textboxes in a form to edit and then save back to the SQL Server.
Though when a value is NULL in the DB, I get this error
Conversion from type 'DBNull' to type 'String' is not valid.
Exception Details: System.InvalidCastException: Conversion from type
'DBNull' to type 'String' is not valid.
Source Error:
Line 1706: Get
Line 1707: Try
Line 1708: Return CType(Me
(Me.tableFamilies.FirstNameColumn),String)
Line 1709: Catch e As
Global.System.InvalidCastException
Line 1710: Throw New
Global.System.Data.StrongTypingException("The value for column
'FirstName' in table 'Families' is DBNull.", e)
Here is where I am assigning the value
txtFirstName.Text = family(0).FirstName
Is there a way to rewrite the above assigning line to test the value
if NULL and just add a blank string?
Thanks
textboxes in a form to edit and then save back to the SQL Server.
Though when a value is NULL in the DB, I get this error
Conversion from type 'DBNull' to type 'String' is not valid.
Exception Details: System.InvalidCastException: Conversion from type
'DBNull' to type 'String' is not valid.
Source Error:
Line 1706: Get
Line 1707: Try
Line 1708: Return CType(Me
(Me.tableFamilies.FirstNameColumn),String)
Line 1709: Catch e As
Global.System.InvalidCastException
Line 1710: Throw New
Global.System.Data.StrongTypingException("The value for column
'FirstName' in table 'Families' is DBNull.", e)
Here is where I am assigning the value
txtFirstName.Text = family(0).FirstName
Is there a way to rewrite the above assigning line to test the value
if NULL and just add a blank string?
Thanks