D
DHess
Using vb.net, ado (obviously) newest mdac and 1.1 framework. Here is my
problem:
I have a table that gets a record inserted into it, with a flag set to the
number 1. Potentially, there could be a record with the flag set to 0 as
well. What I do in my codebehind is first, delete the "0" record with a
call to executenonquery. Then, I "update" the the one record and change
it's flag to "0". What happens is randomly, sometimes, it works right and
sometimes it ends up deleting BOTH records. It is hard to reproduce the
error. What seems like is happening is that the update is getting called
FIRST, so BOTH records are getting set to "0", then it calls the delete
SECOND. It doesn't ALWAYS do this, but does sometimes. I tried making a
transaction and then forcing it to commit after the delete, but that
didn't seem to work. Pro grammatically, the delete is always called
first.
Does anyone have any suggestions? I didn't write this code, and am
only trying to bugfix it. This routine appears TONS of times in the code,
so I hope I don't have to re-write it.
Don
problem:
I have a table that gets a record inserted into it, with a flag set to the
number 1. Potentially, there could be a record with the flag set to 0 as
well. What I do in my codebehind is first, delete the "0" record with a
call to executenonquery. Then, I "update" the the one record and change
it's flag to "0". What happens is randomly, sometimes, it works right and
sometimes it ends up deleting BOTH records. It is hard to reproduce the
error. What seems like is happening is that the update is getting called
FIRST, so BOTH records are getting set to "0", then it calls the delete
SECOND. It doesn't ALWAYS do this, but does sometimes. I tried making a
transaction and then forcing it to commit after the delete, but that
didn't seem to work. Pro grammatically, the delete is always called
first.
Does anyone have any suggestions? I didn't write this code, and am
only trying to bugfix it. This routine appears TONS of times in the code,
so I hope I don't have to re-write it.
Don