Inserting Nulls into a Dataset

  • Thread starter Thread starter Richard Payne
  • Start date Start date
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
 
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
 
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
 
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
 
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
 
Back
Top