vb.net Null Values

ahbenshaut

Well-known member
Joined
Oct 29, 2004
Messages
62
Location
Alaska
Programming Experience
5-10
Greetings All!
I have a SQL database and I am creating a VB.Net front end. My question is: In the database, if a field does not have any data the value is <NULL>. In the application, I want to be able to assign a Null value to several datatypes. I could use an empty space as a value (ie. dim str as string="") but then not only do I need to trap for <Null> values, I would also need to trap for empty values.

Is it possible to assign variables the value of Null?
 
If you want to assign a null value to a database field, assign it DBNull.Value. An empty string IS NOT a null value. An empty string is a string value of length 0, while a null value is no value at all. You cannot assign an empty string to a numerical field, while you can assign a null value.
 
Back
Top