By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,160 Members | 1,983 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,160 IT Pros & Developers. It's quick & easy.

Problem in Data Set update to database

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
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

P: n/a

"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.