471,310 Members | 1,057 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

dataset/database update



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,"Ca tegories");
*** Sent via Developersdex http://www.developersdex.com ***
Dec 5 '05 #1
3 1122
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Marie-Christine Bechara" <ma*********************@ifsal.com> wrote in
message news:%2********************@tk2msftngp13.phx.gbl.. .


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,"Ca tegories");
*** Sent via Developersdex http://www.developersdex.com ***

Dec 5 '05 #2

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??
*** Sent via Developersdex http://www.developersdex.com ***
Dec 5 '05 #3
Marie,

Short of moving to .NET 2.0, no.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Marie-Christine Bechara" <ma*********************@ifsal.com> wrote in
message news:e3****************@TK2MSFTNGP11.phx.gbl...

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??
*** Sent via Developersdex http://www.developersdex.com ***

Dec 5 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Mike Hnatt | last post: by
reply views Thread by Vijay Balki | last post: by
4 posts views Thread by Peter Proost | last post: by
7 posts views Thread by Jean Christophe Avard | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.