Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Empty String to NULL

Status
Not open for further replies.

MarcusO

IS-IT--Management
Mar 28, 2001
13
0
0
AU
Hello,

I am using SQL Server 2000 as database. When a user updates a record, let's say phone no, and just erases the value already stored, then VB.Net tries to store it as a zero-string. This doesn't work that well and SQL Server throws an error. Do I really have to check every value with if/then/else first to see if it is zero-string and if so convert it it NULL before running the update query?

Thanks,
Marcus
 
In a word, yes. How else is ADO.NET to know what you mean?

You can also do it in the stored procedure if you're using one.

If you're using a strongly typed dataset there is a method of the dataset that will set the the column to null that can be called if the string is zero length.



Bob Boffin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top