Page 1 of 1

Access violation in procedure TCustomDADataSet.ApplyUpdates

Posted: Wed 18 Jan 2012 16:37
by tinu
Hi

We updated to odac version 8.1.4.
Now we get Access violations when calling ApplyUpdates on a TOraQuery. Searching in this forum I found a thread with probably the same problem: ChachedUpdates Error in 8.1.4

Could you tell us how to fix this in the code (DBAccess.pas)

Code: Select all

procedure TCustomDADataSet.ApplyUpdates(const UpdateRecKinds: TUpdateRecKinds);
var
  //...
if UsedConnection.IsMultipleTransactionsSupported or
  (FConnection.Options.DisconnectedMode and (AutoCommit = False))
   ^-- FConnection is nil

thanks

Posted: Thu 19 Jan 2012 09:29
by AlexP
Hello,

For fixing this problem, you should make the following changes in the MemData.pas module in the TMemData.ApplyUpdates method.

The following code

Code: Select all

    finally
      if OldCurrentItem.Flag = flUsed then
        CurrentItem := OldCurrentItem;
    end;
Change with

Code: Select all

   finally
      if (OldCurrentItem = nil) or (OldCurrentItem.Flag = flUsed) then
        CurrentItem := OldCurrentItem;
    end;

Posted: Wed 25 Jan 2012 15:30
by wraaflaub
Hello,

we tried the above fix, but with no success. Instead we changed the following line in DBAccess in TCustomDADataSet.ApplyUpdates from:

Code: Select all

(FConnection.Options.DisconnectedMode and (AutoCommit = False))
to:

Code: Select all

(UsedConnection.Options.DisconnectedMode and (AutoCommit = False))
This seemed to work.

Cheers,
Walter

Posted: Thu 26 Jan 2012 09:40
by AlexP
Hello,

The code I have performed fixes the problem with the ApplyUpdate call for an empty DataSet, if you face this problem in an other situation, please perform a code abstract, which causes the error, or send a sample reproducing the problem to alexp.devart.com

Posted: Mon 13 Feb 2012 08:27
by vassot
Hello, I have the same problem (AccessViolation at ApplyUpdates) with odac version 8.1.4. but I do not have the source code. How can I fix this?

Posted: Wed 15 Feb 2012 15:48
by AndreyZ
This fix will be included in the next ODAC build. We plan to release new builds of all DAC components as soon as RAD Studio XE2 Update 4 is released. This way, we will be able to provide all DAC components compatible with the new update.

Still having problem with ApplyUpdates

Posted: Thu 22 Mar 2012 09:53
by vassot
I still get an access violation at ApplyUpdates. I have setup Delphi Xe2 Update 4 and odac 8.1.5. Please tell me what might have gone wrong.

Posted: Thu 22 Mar 2012 11:56
by AlexP
Hello,

Please provide us a piece of code where the error arises.

Problem fixed

Posted: Fri 23 Mar 2012 09:56
by vassot
I am sorry for my previous message. I was getting an access violation because my dataset's session property was blank.

Posted: Fri 23 Mar 2012 13:49
by AlexP
Hello,

Glad to see that the problem was solved. If you have any other questions, feel free to contact us.