if dr.Item("middle_name") is DBNull.Value then
txtMiddleName.Text = ""
It is easier to just write:
txtMiddleName.Text = dr.Item("middle_name").ToString
because adding "ToString" will convert nulls to "" empty strings.
If you omit the "ToString", any nulls will generate an error (converting a Null to a String).
No comments:
Post a Comment