Interpret blank text field as null value

Vijizzle

New member
Joined
Sep 15, 2006
Messages
2
Programming Experience
Beginner
Hey,

Some columns in my server 2005 table are descibed as 'not null'.
However if I do an insert through my vb.net form and leave the not null taxt field blank the rest of the values still get inserted into my table and the not null fields are left blank.

Is there some way in vb.net (besides checking for a blank text field and then
replacin git with 'null') where it will by default send 'null' when it encounters a blank text field.

Thnks
 
Are you aware of the difference between a null and an empty string?

An empty string "" is a string with no characters inside. Like a packet of sweets with no sweets inside - it's still a packet
A null string is no string at all. Like not having a packet of sweets at all

If you set your vb.net up so that a column is Null by default, and throws an exception upon nulls, you will need to give the column a value before sending it into the data table, much less sending the table into the database.

If someone has seen the "not null, but defaults to null" problem they may have set the default value to be ""

Or, if the data is bound to the .Text property of a textbox, you may find that a blank textbox actually contains a string that is empty (no characters) rather than no string at all.
 
Back
Top