Subject Re: [IBO] New user - IB_Query help
Author Helen Borrie (TeamIBO)
At 01:18 PM 08-04-02 +0000, Edison wrote:

>I followed your instructions and it is almost working. I used as a
>test the following code:
>
> Ib_transaction1.StartTransaction;
> ib_query1.insert;
> ib_query1.fieldbyname('MyField1').value := '1111111'; {PK}
> ib_query1.fieldbyname('MyTime').value := Now; {PK}
> ib_query1.fieldbyname('MyValue').Value := 'Test value';
> ib_query1.Post;
> ib_Transaction1.CommitRetaining;
>
>In the form I have the IB_Datasource1, IB_Query1, IB_Transaction1 and
>a IB_Grid1 components. IB_Query1 with KeylinksAutodefine = True.
>After the execution, the new record apears in the grid but if I close
>the application, and re-opens it, the new inserted record is not
>present.

If it was committed and you got no error, then it is there.
Try repeating your experiment with an IB_MonitorDialog showing on your
form. Watch what happens there and, if possible, copy/paste the relevant
pieces to the list.

>I tryed also with the transaction autocomit set to true.

Autocommit is disabled by StartTransaction. To see the effects of
Autocommit, you would need to remove that and the call to CommitRetaining.

It sounds as if now would be a good time for you to study some of the
TechInfo sheets. :))

Also, instead of closing the application, run IB_SQL whilst you test your
code. Then you can watch what the database is receiving: set up a query
on the Cursor tab and run it each time after you think your test app has
committed an insert.

>In the real application, I will need to have complete control of
>transaction controlling simultaneous insertions in 3 different tables.

Normally in Firebird/InterBase you would do this by means of a
parameterized stored procedure in the InsertSQL property of the database
where the user is doing data input. If you don't need the user to see the
dataset at all, you can do it all by "blind" SQL - just picking up
parameters from user selections, and passing them to a DSQL for execution.


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