Subject | Re: [IBO] Transaction confusion |
---|---|
Author | Helen Borrie (TeamIBO) |
Post date | 2002-01-15T03:13:54Z |
At 10:05 AM 15-01-02 +1100, John Peterson wrote:
I agree with Geoff, you are probably getting these periodic Invalid Transaction Handle errors because your DSQL is sitting in the same transaction as something else that either committed or rolled the transaction back, so that, once in a while, there is no transaction when you expect one.
You don't seem to be doing any exception handling to cover that possibility and I think that, at the very least, you will have to test for InTransaction before attempting to execute your statement.
Another observation + a couple of questions:
if not DM1.Prepared then DM1.Prepare;
with DM1 do begin
Params[0].AsInteger := StrToInt(copy(Su9.Line[3],29,6)); //SIDO
......
Params[84].AsString := copy(Su9.Line[5],71,1); // Tyre Decal
Execute;
end;
The SQL property is a TStrings...but perhaps this was just mistyping in your mail program.
Second, why are you passing constants to Params? Are these data going into non-data-aware controls?
Curious...
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at www.ibobjects.com
>Hi All,John,
>I have a fairly simple service application that inserts records into a table. The app uses TIB_CONNECTION and TIB_DSQL components in a Data Module to perform the insertion.
I agree with Geoff, you are probably getting these periodic Invalid Transaction Handle errors because your DSQL is sitting in the same transaction as something else that either committed or rolled the transaction back, so that, once in a while, there is no transaction when you expect one.
You don't seem to be doing any exception handling to cover that possibility and I think that, at the very least, you will have to test for InTransaction before attempting to execute your statement.
Another observation + a couple of questions:
>Code snippet:Assuming DM1 is the DSQL object:
>
> if not DM1.SQL.Prepared then DM1.SQL.Prepare;
> with DM1.SQL.Params do begin
> Columns[0].AsInteger := StrToInt(copy(Su9.Line[3],29,6)); //SIDO
> ......
> Columns[84].AsString := copy(Su9.Line[5],71,1); // Tyre Decal
> end;
> DM1.SQL.Execute;
>
>SQL:
>
>INSERT INTO TRM
> (
> "SIDO",
> .......
> "TYREDECAL"
> )
>values
> (
> ?SIDO,
> .......
> ?TyreDecal
> )
if not DM1.Prepared then DM1.Prepare;
with DM1 do begin
Params[0].AsInteger := StrToInt(copy(Su9.Line[3],29,6)); //SIDO
......
Params[84].AsString := copy(Su9.Line[5],71,1); // Tyre Decal
Execute;
end;
The SQL property is a TStrings...but perhaps this was just mistyping in your mail program.
Second, why are you passing constants to Params? Are these data going into non-data-aware controls?
Curious...
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at www.ibobjects.com