Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is there a way to make DataAdapter not call Acceptchanges after Update Method

27 views
Skip to first unread message

jka...@hotmail.com

unread,
Apr 9, 2004, 3:00:47 PM4/9/04
to
Hi,

Here is the problem I'm facing.
I'm working on a system where I need to make DataAdapter.Update method
call to update the database. After the update is complete I need to
make a call to an external system. (I know it's not the prettiest
picture but for now I do need to update the database before I make the
external system call, because in our current design our handler that
make external system calls gather this updated information from
different tables in the DB)

The problem is the external system might return an error and I'd need
to roll back my changes to the DB earlier.

I do the update using Update Method in the DataAdapter. It would be
great if I could make DataAdapter not to call AcceptChanges so I can
call RejectChanges on the dataset and update back to the DB. Is there
a way to do this?

Thanks in advance for your help.

Jin

Marina

unread,
Apr 9, 2004, 3:45:31 PM4/9/04
to
I don't believe there is. What you could do, is make a copy of the dataset
by calling GetChanges, and use that copy later on for your other update.

<jka...@hotmail.com> wrote in message
news:64ba1b2.04040...@posting.google.com...

Cor Ligthert

unread,
Apr 10, 2004, 7:23:30 AM4/10/04
to
Hi Marina,

> I don't believe there is. What you could do, is make a copy of the
dataset
> by calling GetChanges, and use that copy later on for your other update.

Is that not answering with "Yes there is", what does it not as asked, it
preserves the updates whatever the dataadpater does with it.

:-)))

Cor


Joe Fallon

unread,
Apr 10, 2004, 4:09:22 PM4/10/04
to
Making a copy of the datasst is probably the simplest solution.

Another idea:
Can't you use Distributed Transaction Coordinator in COM+ for this?
--
Joe Fallon


<jka...@hotmail.com> wrote in message
news:64ba1b2.04040...@posting.google.com...

jka...@hotmail.com

unread,
Apr 12, 2004, 3:23:56 PM4/12/04
to
Thanks a lot for your replies.
Copying DataSet seems like a very good idea.
Thanks

Jin


"Joe Fallon" <jfal...@nospamtwcny.rr.com> wrote in message news:<OsV$yezHEH...@TK2MSFTNGP10.phx.gbl>...

David Sceppa

unread,
Apr 12, 2004, 5:28:07 PM4/12/04
to
Jin,

If you want to keep the DataAdapter from implicitly calling
AcceptChanges after submitting the pending changes in a row,
handle the DataAdapter's RowUpdated event and set
RowUpdatedEventArgs to UpdateStatus.SkipCurrentRow.

I hope this information proves helpful.

David Sceppa
Microsoft
This posting is provided "AS IS" with no warranties,
and confers no rights. You assume all risk for your use.
© 2004 Microsoft Corporation. All rights reserved.

Marina

unread,
Apr 13, 2004, 1:22:23 PM4/13/04
to
No, it is quite different. There is no way to make the dataadapter not call
AcceptChanges on the dataset it just updated. No matter what you do, it
will always make this call.

What I suggested was a workaround for this problem.

"Cor Ligthert" <notfir...@planet.nl> wrote in message
news:ON9R96uH...@TK2MSFTNGP11.phx.gbl...

Cor Ligthert

unread,
Apr 13, 2004, 1:53:57 PM4/13/04
to
Ok Ok however you gave the right answer on the explicit question in my
opinion.

Another thing is that I thought that when you do a update as this

myAdapter.update(dataset.getchanges)

the acceptchanges is not done (was more a problem I once had)

However some time ago, so do not shoot me when I am wrong.

:-)

Cor


Marina

unread,
Apr 14, 2004, 11:02:06 AM4/14/04
to
OK :)

"Cor Ligthert" <notfir...@planet.nl> wrote in message

news:%23tzTKDY...@TK2MSFTNGP10.phx.gbl...

0 new messages