dataset/database update

  • Thread starter Thread starter Marie-Christine Bechara
  • Start date Start date
M

Marie-Christine Bechara

i have a webservice that returns a dataset holding all categories.
i want to enter these rows in the database by calling the data
adapter's update method.
i'm doing the following but no update to my database is made. why is
that?


Code:
this.dsetMustaqbal = currentIssueWS.GetCategories();

this.sqlDataAdapter1.Update(this.dsetMustaqbal,"Categories");
 
Marie,

The reason is that when the dataset is passed to you, it is not listed
as being changed in any way. You have to modify the row in order for the
adapter to pick it up.

If you are using .NET 2.0 or above, you can call the SetAdd method on
the DataRow object to set the state to add (assuming you want to add it).
If not, then you should create a table with a similar structure, and insert
new rows into it from the old data table, so that the state is set to added.
Then, when you pass this to the adapter, it will insert the rows in the
table.

Hope this helps.
 
I am using studio 2003.
I i must add rows from the old data table, then there will be a for loop
on the datarows of the old one.The for loop will take time in case of
large numbers of records.

There is no where to avoid adding a temporary table and copying its rows
to my dataset??
 
Back
Top