Re: working with SQL null values....

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



SurturZ wrote:

However, I have found that the "hacks" to avoid DBNulls are usually
easier to read than processing DBNulls. Let's face it, programmers
that allow DBNulls in their database usually have some little
function called NULLSAFE or something that converts DBNulls to empty
strings anyway.

For your example of apartment number, either the address is complete
or it isn't. If the apartment number is "" you can assume the address
is not an apartment and format the address appropriately.


I have no trouble with 0 length strings instead of null, but then again, I have
no trouble with null string fields in the first place. VB seems happy to return
"" from the ToString method.

For Dates, on the other hand, Nulls can be quite meaningful, where a fake date
is not helpful. When is the wedding? Null, for now. Specifying anything else
would be misleading.


.