471,320 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Problem in Data Set update to database

Hi All,
I am fetching a dataset from the database under some condition. After
this I create a data table. Traverse in the original dataset & add
each row to created data table as it is through LoadDataRow method.
After adding the row I just update 4-5 columns out of 20 columns in
the row. After entire looping I fire the AcceptChanges method on data
table. After this I am trying to update this data back to database in
two ways -
1) Merge the above datatable to the original dataset & update it back
to database through the data adapter. The data adapter I used in one
case was the same with which I filled the original dataset. And in
second case I created a fresh data adapter & tried to update.
2) In another method I just tried to update the created data table as
it is to the database.
I have also created the appropriate commands for the data adapter
through command builder. But unfortunately even after getting no
errors on the Update call of the data adapter there are no records
getting added to the database.
Any kind of pointers are dearly welcome.

Jul 10 '07 #1
6 3661
Did you check the RowState on the affected rows?
Peter

"Suresh" <su************@gmail.comwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
Hi All,
I am fetching a dataset from the database under some condition. After
this I create a data table. Traverse in the original dataset & add
each row to created data table as it is through LoadDataRow method.
After adding the row I just update 4-5 columns out of 20 columns in
the row. After entire looping I fire the AcceptChanges method on data
table. After this I am trying to update this data back to database in
two ways -
1) Merge the above datatable to the original dataset & update it back
to database through the data adapter. The data adapter I used in one
case was the same with which I filled the original dataset. And in
second case I created a fresh data adapter & tried to update.
2) In another method I just tried to update the created data table as
it is to the database.
I have also created the appropriate commands for the data adapter
through command builder. But unfortunately even after getting no
errors on the Update call of the data adapter there are no records
getting added to the database.
Any kind of pointers are dearly welcome.

Jul 10 '07 #2
On Jul 10, 2:56 pm, "Peter Bradley" <pbrad...@uwic.ac.ukwrote:
Did you check the RowState on the affected rows?

Peter

"Suresh" <sureshmishr...@gmail.comwrote in message

news:11*********************@q75g2000hsh.googlegro ups.com...
Hi All,
I am fetching a dataset from the database under some condition. After
this I create a data table. Traverse in the original dataset & add
each row to created data table as it is through LoadDataRow method.
After adding the row I just update 4-5 columns out of 20 columns in
the row. After entire looping I fire the AcceptChanges method on data
table. After this I am trying to update this data back to database in
two ways -
1) Merge the above datatable to the original dataset & update it back
to database through the data adapter. The data adapter I used in one
case was the same with which I filled the original dataset. And in
second case I created a fresh data adapter & tried to update.
2) In another method I just tried to update the created data table as
it is to the database.
I have also created the appropriate commands for the data adapter
through command builder. But unfortunately even after getting no
errors on the Update call of the data adapter there are no records
getting added to the database.
Any kind of pointers are dearly welcome.- Hide quoted text -

- Show quoted text -
Thanks Peter for the quick response.
I didn't check the RowState but I did check & found that the rows were
indeed getting added to the merged dataset. But as said not getting
inserted into the database. Please let me know if you need me to check
the RowState & tell you what value I am getting.

Jul 10 '07 #3
"Suresh" <su************@gmail.comwrote in message
news:11**********************@r34g2000hsd.googlegr oups.com...
Thanks Peter for the quick response.
I didn't check the RowState but I did check & found that the rows were
indeed getting added to the merged dataset. But as said not getting
inserted into the database. Please let me know if you need me to check
the RowState & tell you what value I am getting.
Does this help:

http://www.knowdotnet.com/articles/datasetmerge.html
Peter
Jul 10 '07 #4
On Jul 10, 4:52 pm, "Peter Bradley" <pbrad...@uwic.ac.ukwrote:
"Suresh" <sureshmishr...@gmail.comwrote in message

news:11**********************@r34g2000hsd.googlegr oups.com...
Thanks Peter for the quick response.
I didn't check the RowState but I did check & found that the rows were
indeed getting added to the merged dataset. But as said not getting
inserted into the database. Please let me know if you need me to check
the RowState & tell you what value I am getting.

Does this help:

http://www.knowdotnet.com/articles/datasetmerge.html

Peter
It's a little long article so let me have a nice look at it & then I'd
try the same. But by the initial reading it seems that I am doing the
other way round so it probably might work. Would keep you posted on
the updates. But really thanks for this article which says how we work
with DataAdapters is absolutely wrong & opposite to what it should be.

Jul 10 '07 #5
On Jul 10, 5:45 pm, Suresh <sureshmishr...@gmail.comwrote:
On Jul 10, 4:52 pm, "Peter Bradley" <pbrad...@uwic.ac.ukwrote:
"Suresh" <sureshmishr...@gmail.comwrote in message
news:11**********************@r34g2000hsd.googlegr oups.com...
Thanks Peter for the quick response.
I didn't check the RowState but I did check & found that the rows were
indeed getting added to the merged dataset. But as said not getting
inserted into the database. Please let me know if you need me to check
the RowState & tell you what value I am getting.
Does this help:
http://www.knowdotnet.com/articles/datasetmerge.html
Peter

It's a little long article so let me have a nice look at it & then I'd
try the same. But by the initial reading it seems that I am doing the
other way round so it probably might work. Would keep you posted on
the updates. But really thanks for this article which says how we work
with DataAdapters is absolutely wrong & opposite to what it should be.
Yeah Peter,
It did work. And I just don't know how to thank you. As it has not
just eaten up my days but also made me think that ADO.Net is just not
worth using. I had people around me to help but they also landed with
the same conclusion. So thanks a ton for great help & made me realize
that yes we should not draw conclusions unless we know the thing in
whole. Again, thanks buddy.

Jul 10 '07 #6

"Suresh" <su************@gmail.comwrote in message
news:11**********************@57g2000hsv.googlegro ups.com...
Yeah Peter,
It did work. And I just don't know how to thank you.
No need. Glad it worked.
Peter
Jul 10 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Tim | last post: by
14 posts views Thread by Venkat Chellam | last post: by
5 posts views Thread by junglist | last post: by
15 posts views Thread by Scotty | last post: by
5 posts views Thread by Brad Baker | last post: by
11 posts views Thread by SAL | 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.