No problem, Bob. Thanks for the response. I think the
VB equivalent for the null expression is vbNull.
Just as an editorial aside: it occurs as kind of silly to define a nullable type, then not let it take on the value of DBNull directly, considering that the main reason people might want a nullable type in the first place is to populate data from a database. Anyone have an opinion about that? You know I tried this same code but defined FacID as SqlInt32, and it got the same results. You can't cast a SqlInt32 as DBNull either.
Okay, so my second question then is: Populating controls on a page, e.g. textboxes: do I have to do the same thing:
Code:
If FacID.GetType is VBNull.Value Then
Textbox1.Text = ""
Else
Textbox1.Text = FacID
End If
And for that matter, do I need to do the same thing when updating my data store:
Code:
If FacId.GetType is vbNull.Value then
cmd.Parameters.Insert (New SqlParameter ("@FacID", DbNull.Value))
Else
cmd.Parameters.Insert (New SqlParameter ("@FacID", FacID))
End If
Thanks.
Aaron