PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Non-mapped column set to NULL during Fill.

Reply

Non-mapped column set to NULL during Fill.

 
Thread Tools Rate Thread
Old 10-02-2006, 10:19 AM   #1
Alex Kosov
Guest
 
Posts: n/a
Default Non-mapped column set to NULL during Fill.


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


  Reply With Quote
Old 10-02-2006, 11:12 AM   #2
Val Mazur \(MVP\)
Guest
 
Posts: n/a
Default Re: Non-mapped column set to NULL during Fill.

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


"Alex Kosov" <ak@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
>
>



  Reply With Quote
Old 10-02-2006, 11:56 AM   #3
Alex Kosov
Guest
 
Posts: n/a
Default Thanks

Thank you very much, Val, for your help.

Alex


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off