Inserting Nulls into a Dataset

R

Richard Payne

Hi

I have a simple table which allows nulls. Using a Dataset I have added a new
rows to the table specifying the values for the columns I have and leaving
the others.

When I come to run the update command via the dataadapter the insert stored
procedure fails because the parameters corresponding to the null fields in
the dataset and not supplied. How do I get round this?

Regards
 
T

Thorsten Kallweit

Hi,

there's a type called DBNull you can try. It represents the null-value
of databases. set each value that you want to leave out to DBNull.Value.
that should work.

hth,
Thorsten
 
R

Richard Payne

Hi

Thanks for your reply. The dataset is strongly typed so it doesn't allow we
to set the value to DBNull.Value.

Regards

Richard
 
R

Richard Payne

Hi

Think your reply got lost.

Some additional information, I have found that I can set a column in the row
to null using the SetNull method. However it is still the case that when I
run the update command it doesn't send all the parameters to the Insert
stored procedure.

Regards
 
R

Richard Payne

Opps

Sorry problem solved, I hadn't set up my parameters correctly in the
SQLCommand object for my insert command.

Sorry for any time wasted

Regards

Richard
 

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