Default Values

J

JMM B

When doing the update of a dataset with added rows, passing null values
to columns that contain DEFAULT value defined in the DataBase, I don't
get the default value back with the updated DataSet. In fact, it inserts
null values in the database. I tried to modify the schema of the table
to change this behaviour, but it seems to not work.

thanks,
 
W

William \(Bill\) Vaughn

To use the database-defined default, you have to supply NO value to the
UPDATE for this column--not NULL.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
J

JMM B

Ok, but how can I send NO values to the UPDATE. In the xml schema of the
Dataset, there is a property called "NullValue" with three possible
values: null, empty, throw. I set it to "empty" but still inserts null
values in the database.
I didn't manage to make it work.
thanks,
 
W

William \(Bill\) Vaughn

First, table-defined default values are applied when a data row is INSERTED,
not UPDATED--and then only when the INSERT statement does not supply the
explicit value.

When using a stored procedure that executes an UPDATE, the procedure can
define any number of parameters that can have default values. When executing
the stored procedure with ADO and want the parameter to be set to this
default value, you simply build a Parameters collection that does not
include the Parameter.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top