Subject RE: [IBO] Re: Create TIB_Transaction and TIB_StoredProc with code ...
Author Eric Tishler
I think the AddConnection is only if you wish to have connections to multiple databases. For the single database

FTransaction.IB_Connection := Connection;


Should work.

I created TIB_Connection and TIB_Transaction in code as follows

Procedure foo;
VAR
IB_Connection: TIB_Connection;
IB_Transaction: TIB_Transaction;
BEGIN
IB_Connection := TIB_Connection.Create(nil);
IB_Transaction := TIB_Transaction.Create(nil);

IB_Connection.DefaultTransaction := IB_Transaction;
IB_Connection.OnError := IB_ConnectionError;
END;

Don't forget to clean up afterwards with something like

Procedure bar;
BEGIN
IB_Transaction.Free;
IB_Connection.Free;
END;

This worked just fine for me ...


Eric Tishler
Software Architect
Resolute Partners, LLC
Phone: 203.271.1122
Fax: 203.271.1460
etishler@...

-----Original Message-----
From: tractaylor [mailto:tractaylor@...]
Sent: Thursday, April 01, 2004 3:45 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] Re: Create TIB_Transaction and TIB_StoredProc with code ...

I am not really sure what the problem is, but I think you need to add
the connection to the IB_Transaction like this :

FTransaction.AddConnection(Connection);

instead of

FTransaction.IB_Connection := Connection;

But again, are you getting errors or something? If so, what are they?


Hope this helps.

Trac


--- In IBObjects@yahoogroups.com, "dchri2000" <dchri@i...> wrote:
> Hi all,
>
> how do i create a TIB_Transaction and TIB_StoredProc, with code,
> assign the TIB_Transaction to TIB_StoredProc and a design-time
> TIB_Connection to TIB_Transaction ?
>
> I thought that it was somethink like this :
>
> <snip>
>
> constructor TSerialConnection.Create(AOwner: TComponent; CommName:
> ShortString;
> Connection: TIB_Connection);
> begin
> FBeepsCount := 0;
>
> FSerialPort := TSerialPortNG.Create(AOwner);
> FSerialPort.OnRxClusterEvent := DoRXClusterEvent;
> FSerialPort.FlowControl := 1;
> FSerialPort.CommPort := CommName;
>
> FTransaction := TIB_Transaction. Create(AOwner);
> FTransaction.IB_Connection := Connection;
> FTransaction.Isolation := tiCommitted;
> FTransaction.LockWait := True;
>
> FStoredProcedure := TIB_StoredProc.Create(AOwner);
> FStoredProcedure.IB_Transaction := FTransaction;
> FStoredProcedure.IB_Connection := Connection;
> FStoredProcedure.SQL.Add('EXECUTE PROCEDURE EMPLOYEE_ENTRY ?
> EMP_BARC');
>
> FTimer := TTimer.Create(AOwner);
> FTimer.Enabled := False;
> FTimer.Interval := 250;
> FTimer.OnTimer := DoTimer;
> end;
>
> < snip >
>
>
> Any hint ?
>
> Dimitris



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !



_____

Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/IBObjects/

* To unsubscribe from this group, send an email to:
IBObjects-unsubscribe@yahoogroups.com <mailto:IBObjects-unsubscribe@yahoogroups.com?subject=Unsubscribe>

* Your use of Yahoo! Groups is subject to the Yahoo! Terms of <http://docs.yahoo.com/info/terms/> Service.


[Non-text portions of this message have been removed]