INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

ApplyUpdates won't repeat sequntuallly

ApplyUpdates won't repeat sequntuallly

(OP)
My OS is W-XP-Prof and have been using Delphi 6 Enterprise for many years.

In the process I have successfully relied on ApplyUpdates as below.

ModifySQL.Clear;
ModifySQL.Add ('update');

if (dmStdAcc.PivotTbl1KeyOrigin.value = 'GL')then
ModifySQL.Add ('''C:\h\StdAcc\'+ IntToStr(dmStdAcc.PivotTbl1PNo.AsInteger) + '\GenAccs''');

ModifySQL.Add ('set');
ModifySQL.Add ('LAccNo = :LAccNo, LAccNo2 = :LAccNo2, AccDate = :AccDate, Doc = :Doc, FileNo = :FileNo, Vat = :Vat,');
ModifySQL.Add ('OppAccName = :OppAccName, OppAccNo = :OppAccNo, OppAccNo2 = :OppAccNo2, Amount = :Amount, Balance = :Balance, Job = :Job');
ModifySQL.Add ('where');
ModifySQL.Add ('Akv = :OLD_Akv');

InsertSQL.Clear;
InsertSQL.Add ('insert into');

if (dmStdAcc.PivotTbl1KeyOrigin.value = 'GL') then
InsertSQL.Add ('''C:\h\StdAcc\' + IntToStr(dmStdAcc.PivotTbl1PNo.AsInteger) + '\GenAccs''');

//Insert SQL for BOTH Ledger Accounts
InsertSQL.Add ('(LAccNo, LAccNo2, AccDate, Doc, FileNo, Vat, OppAccName, OppAccNo,');
InsertSQL.Add ('OppAccNo2, Amount, Balance, Job)');

InsertSQL.Add ('values');
InsertSQL.Add ('(:LAccNo, :LAccNo2, :AccDate, :Doc, :FileNo, :Vat, :OppAccName, :OppAccNo, :OppAccNo2, :Amount, :Balance, :Job)');

DeleteSQL.Clear;
DeleteSQL.Add ('delete from');

if (dmStdAcc.PivotTbl1KeyOrigin.value = 'GL') then
DeleteSQL.Add ('''C:\h\StdAcc\' + IntToStr(dmStdAcc.PivotTbl1PNo.AsInteger) + '\GenAccs''');

DeleteSQL.Add ('where');
DeleteSQL.Add ('Akv = :OLD_Akv');

if dmStdAcc.qryAccount.UpdatesPending then
dmStdAcc.qryAccount.ApplyUpdates;

More recently, after having done some re-engineering elsewhere in the Application, the ApplyUpdates [as above] still works successfully ONCE! BUT in a sequential attempt immediately afterwards I get exception "Update has failed".

What am I missing? What might I have done during re-engineering to upset this?

delphiman

Old Man Delphi

RE: ApplyUpdates won't repeat sequntuallly

(OP)
Problem solved. In fact the procedure works perfectly when induced sequentially. Problem was given rise to elsewhere in the Application.

Old Man Delphi

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close