Updating a DataSet to a new ado.net adatper....

  • Thread starter Thread starter Raul Cortes
  • Start date Start date
R

Raul Cortes

I have filled a DataSet reading from an odbc data adapter, adapterO

I whish to add the records in my original data set,
to my msde data, so i builded another data adapter adapterD

I tried

adapterO.Fill ( dsO ); // read records
adapterD.Update (dsO); // 'add' records

This WON'T WORK, because the dataset has no changes, so it does not adds any
record.

What can I do. Is it necesary to add everey single data row from dsO
into a new dsD DataSet so the adapter will do the work?

I also tried this code, and WONT'T WORK either... :(

adapterO.Fill ( dsO ); // read records
dsD = new DataSet();
dsD = dsO.Copy();
adapterD.Update (dsD); // add records

Any ideas??


Thanks,
 
Hi Raul,

Before doing Fill, set adapterO.AcceptChangesDuringFill = false, so all rows
will be flagged as New.
 
Thank you!!!

That is exactly what i was looking for.

;)

Raul

Miha Markic said:
Hi Raul,

Before doing Fill, set adapterO.AcceptChangesDuringFill = false, so all
rows will be flagged as New.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

Raul Cortes said:
I have filled a DataSet reading from an odbc data adapter, adapterO

I whish to add the records in my original data set,
to my msde data, so i builded another data adapter adapterD

I tried

adapterO.Fill ( dsO ); // read records
adapterD.Update (dsO); // 'add' records

This WON'T WORK, because the dataset has no changes, so it does not adds
any record.

What can I do. Is it necesary to add everey single data row from dsO
into a new dsD DataSet so the adapter will do the work?

I also tried this code, and WONT'T WORK either... :(

adapterO.Fill ( dsO ); // read records
dsD = new DataSet();
dsD = dsO.Copy();
adapterD.Update (dsD); // add records

Any ideas??


Thanks,
 
Back
Top