Saving NULL Back to Database

krosen01

Newcomer
Joined
Jan 30, 2004
Messages
4
Location
New York City
I know this may not be the best practice, but I want to save NULL back to the database.

For example say I have a a colum in the database that stores some information that is optional in the database and when I print the report or form I check to see if the colum is null before printing, otherwise I will print.

What if I saved a value in the column but would like to clear it out.

This is where I'm stuck. I don't want to rewrite most of the code.... assume that the coulmns can be money or text/char/etc and I need to put a NULL value back.

How can I do this with ADO.

I require ADO, but I wouldn't mind knowing in ADO.NET also, but my code is ADO.

Thanks
 
I'm using the Value property.

This is a case where there are many text fields that may or may not be saved or updated based on whether they contain data.

Creating a SQL string for an Insert or Update in this case can be difficult (I tried and was ready to start pulling my hair out for every permutation).

Using the Value property of the Recordset in ADO allows you to assign a value like this:

rs("Column").Value = "Somevalue"

I just need to know how to save null

rs("Column").Value = NULL

doesn't work of course, but there has to be some constant value or property to set.

I'm using VB.NET FYI.

Thanks
 
Back
Top