Board index » delphi » Operation Aborted (TQuery, SQL, Cached Updates) - Bit Long -

Operation Aborted (TQuery, SQL, Cached Updates) - Bit Long -

Hi

I've got a problem that just doesn't make any sense.
I keep getting a EAbort (Operation Aborted) when I try to do
Tquery.applyupdates
I'm using Delphi 5, MS-SQL 7, BDE 5.11.
I'm using a TQuery component with cached updates enabled.
The update mode is setup to: upWhereChanged, I can change it to
anything and it doesn't change anything.
This is in a webmodule (ISAPI Dll to be more precise), but that
shouldn't matter.

My Code is like this:
TQuery.Insert;
TQuery.FieldByName(<what ever>).AsString := <what ever>;
TQuery.FieldByName(<what ever>).AsString := <what ever>;
TQuery.FieldByName(<what ever>).AsString := <what ever>;
.
.
.
TQuery.Post;
TDatabase.StartTransaction;
Try
  TQuery.ApplyUpdates;    <=== Error happens when this line is
executed.
  TDatabase.Commit;
  TQuery.CommitUpdates;
else
   TDatabase.Rollback;
    <code to show error message>
end;

This is where it gets wierd.
If I do the following I don't get any errors:
TQuery.Insert;
For Count := 1 to TQuery.FieldCount do
    Begin
        TQuery.Fields.FieldByNumber(Count).AsVariant := 0;
    end;
TQuery.Post;
TDatabase.StartTransaction;
Try
  TQuery.ApplyUpdates;
  TDatabase.Commit;
  TQuery.CommitUpdates;
else
   TDatabase.Rollback;
    <code to show error message>
end;

If I turn off cached updates and enable request live I get this error:
Cannot perform this operation on a closed dataset

In my original I've checked and I'm propagating all the fields with
something, and I have put in checks to make sure it has the right data
type going into the field. All fields in the database are either (I'm
going to use what they are in MS-SQL 7) char, text, or int.

Any suggestions would be of great help. Thanx
___________________________________________
Robert MacLean

 

Re:Operation Aborted (TQuery, SQL, Cached Updates) - Bit Long -


Okay I got it working, but my solution makes no sense. If anyone has
an explanation then please can you tell me ;) thanx so much. below is
the code i used.

 TQuery.Insert;
 For Count := 1 to TQuery.FieldCount do
     Begin
         TQuery.Fields.FieldByNumber(Count).AsVariant := 0;
     end;
{ propergate the fields with real values, not zeros }
 TQuery.FieldByName(<what ever>).AsString := <what ever>;
 TQuery.FieldByName(<what ever>).AsString := <what ever>;
 TQuery.FieldByName(<what ever>).AsString := <what ever>;
 .
 .
 .
 TQuery.Post;
 TDatabase.StartTransaction;
 Try
   TQuery.ApplyUpdates;
   TDatabase.Commit;
   TQuery.CommitUpdates;
 else
    TDatabase.Rollback;
     <code to show error message>
 end;

Also when I checked the database (in M$ enterprise manager) there were
no fields with zeros, all the fields had the right data in them. (?)
___________________________________________
Robert MacLean

Quote
"Robert MacLean" <test> wrote in message

news:3bc6b275$0$235@proctor...
Quote
> Hi

> I've got a problem that just doesn't make any sense.
> I keep getting a EAbort (Operation Aborted) when I try to do
> Tquery.applyupdates
> I'm using Delphi 5, MS-SQL 7, BDE 5.11.
> I'm using a TQuery component with cached updates enabled.
> The update mode is setup to: upWhereChanged, I can change it to
> anything and it doesn't change anything.
> This is in a webmodule (ISAPI Dll to be more precise), but that
> shouldn't matter.

> My Code is like this:
> TQuery.Insert;
> TQuery.FieldByName(<what ever>).AsString := <what ever>;
> TQuery.FieldByName(<what ever>).AsString := <what ever>;
> TQuery.FieldByName(<what ever>).AsString := <what ever>;
> .
> .
> .
> TQuery.Post;
> TDatabase.StartTransaction;
> Try
>   TQuery.ApplyUpdates;    <=== Error happens when this line is
> executed.
>   TDatabase.Commit;
>   TQuery.CommitUpdates;
> else
>    TDatabase.Rollback;
>     <code to show error message>
> end;

> This is where it gets wierd.
> If I do the following I don't get any errors:
> TQuery.Insert;
> For Count := 1 to TQuery.FieldCount do
>     Begin
>         TQuery.Fields.FieldByNumber(Count).AsVariant := 0;
>     end;
> TQuery.Post;
> TDatabase.StartTransaction;
> Try
>   TQuery.ApplyUpdates;
>   TDatabase.Commit;
>   TQuery.CommitUpdates;
> else
>    TDatabase.Rollback;
>     <code to show error message>
> end;

> If I turn off cached updates and enable request live I get this
error:
> Cannot perform this operation on a closed dataset

> In my original I've checked and I'm propagating all the fields with
> something, and I have put in checks to make sure it has the right
data
> type going into the field. All fields in the database are either
(I'm
> going to use what they are in MS-SQL 7) char, text, or int.

> Any suggestions would be of great help. Thanx
> ___________________________________________
> Robert MacLean

Other Threads