Home All Groups Group Topic Archive Search About

Non-mapped column set to NULL during Fill.

Author
10 Feb 2006 10:19 AM
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

Author
10 Feb 2006 11:12 AM
Val Mazur (MVP)
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

--
Val Mazur
Microsoft MVP
http://xport.mvps.org


Show quote
"Alex Kosov" <a*@msiminsk.com> wrote in message
news:OYMqBsiLGHA.2604@TK2MSFTNGP09.phx.gbl...
> 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
>
>
Author
10 Feb 2006 11:56 AM
Alex Kosov
Thank you very much, Val, for your help.

Alex

AddThis Social Bookmark Button