Problem in Data Set update to database

S

Suresh

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

Suresh

Did you check the RowState on the affected rows?

Peter






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

Suresh


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

Suresh

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top