Re: Problems call DataAdapter.Update and Concurrency

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Bart,

Yes there is a PK column that I am returning by using the Rowupdated event
for any .Inserted row.
I use a command builder for update command as I want to make use of the
concurrency exception.
I dont know if it is by design for if I have got something wrong, but I can
call .update many times as long I don't change the data (pretty pointless)
as soon as the data gets changed it causes a concurrency violation. In some
ways this is as desired but I wasn't expecting the violation while using the
same Connection as the first update. The only solution I can find is to
repopulate the datatable using the .fill after each update. This works fine
but is costly as the application uses a heavily lagged WAN.

Any thoughts?

Thanks again,

Steve.



"Bart Mermuys" <bmermuys.nospam@xxxxxxxxxxx> wrote in message
news:I_Qoh.281969$WX6.5836931@xxxxxxxxxxxxxxxxxxxxxxxx
Hi,

"Steve Lloyd" <steve.remove@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:OQt6RD%23MHHA.5064@xxxxxxxxxxxxxxxxxxxxxxx
Sorry, I did not call the .Fill correctly, it works if i do this,
however, the question still remains of whether this can be done without
calling the .fill and avoiding another trip to the database.

By default the DataAdapter will call AcceptChanges on each succesfull
updated row, so you should not call it. Although not necesairly the case
here, calling AcceptChanges at the wrong time may even cause a false
"Concurrency Violation".

If i understand it correctly, you only have this problem when you do : add
record, update, modify same record, update and the problem is helped with
calling Fill in between. Do you have an autonumber PK column in the DB
table, if so , which DB are you using and how are you currently building
the insert command (DataAdapter) ?

HTH,
Greetings



Thanks again

Steve

"Steve Lloyd" <steve.remove@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:eWIId59MHHA.992@xxxxxxxxxxxxxxxxxxxxxxx
Hi all,

I wonder if anyone can explain what is happening here?
I have a dataadapter that I am using to correlate the changes in an SQL
Table to a DataTable. I create a new DataRow then call .Update and
acceptchanges, all works fine. The problem I have is when I try to
amend some of the data and the call the Update again. This time I get a
Concurrency error, which is understandable as the data has changed since
I initially created the table but is not the desired outcome and I was
expecting that after accepting changes can calling the .Fill the
concurrency conflict would be resolved.

Is there a way to get the adpater to update the changed rows. I have
tried calling .Fill after the update but this does not seem to help.
Ideally I would like to work on the datatable and not have to repopulate
from the database every time I update a cell/row.

Thanks for any help you can give.

Steve

Here is the code it use:
Try
_tradeAdapter.Update(_detailsTable)
_detailsTable.AcceptChanges()
_tradeAdapter.Fill(_detailsTable)
Catch exTran As DBConcurrencyException
MsgBox("There has been a conflict error on this trade, please refresh
your details and check", MsgBoxStyle.Critical, "Update Conflict")
s.Logging.ApplicationLog.LoggingLevels.ApplicationError)
End Try








.



Relevant Pages

  • Re: Problems call DataAdapter.Update and Concurrency
    ... the concurrency exception. ... I use a command builder for update command as I want to make use of ... without calling the .fill and avoiding another trip to the database. ... By default the DataAdapter will call AcceptChanges on each succesfull ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Call statements
    ... I have a fair amount of repetitive code, sometimes exactly what a command ... the code into that for reuse instead of calling the button. ... The only real "danger" in invoking controls in this manner, ... not only is it "best to separate Presentation ...
    (microsoft.public.vb.general.discussion)
  • Re: Adept: Discwasher calling-four
    ... Instead, you insert Discwasher's Calling Four card into slot number seven of the Apple's main board, which is no problem at all if your Apple is accompanied by its manual. ... A connector from the expansion card then plugs into the spot where the joy stick, say, would normally plug into the computer, and the joy stick plug goes into the new card, along with those of any three other controllers you might want to use. ... True, only a single command is involved, but there are preliminaries to be attended to, and here the manual accompanying Calling Four begins to let the novice down. ...
    (comp.sys.apple2)
  • Re: Thread Question
    ... thread start command". ... # He meant calling direct vs. subclassing. ... outros povos sem travar batalha, ...
    (comp.lang.python)
  • Re: Ado.net Concurrency exceptions
    ... Just when I thought that after 45 years of working with Boolean Logic, ... >> Select Command: ... >> Removing the checkbox for optimistic concurrency fixed the problem (now I ... I'd change this just to test it and help isolate the problem. ...
    (microsoft.public.dotnet.framework.adonet)