Non-mapped column set to NULL during Fill.

  • Thread starter Thread starter Alex Kosov
  • Start date Start date
A

Alex Kosov

Hello.

I call
myOleDbDataAdapter.Fill(myTypedDataset, "MyTableName");

after i set value of column not mentioned in DataAdapter.

myTypedDataset.MyTable.Guid = Guid.NewGuid().ToString();

this column is not included into any key or relation.

after i fill dataset again.

myOleDbDataAdapter.Fill(myTypedDataset, "MyTableName");

and - my coulmn is set to NULL (DBNull.Value).

How can I prevent this behavior? How can i store value in my column?

Alex Kosov
 
Alex,

Fill method will reset DataTable each time when you call it. Solution to it
is to fill another dataset from the database and merge both using Merge
method of the DataSet. During merge you could specify if you would like to
preserve schema and what should be done with the missing data
 
Back
Top