Subject Re: [IBO] Replacing IBODatabase with Ib_Connection/IB_Transaction
Author Helen Borrie
At 02:02 PM 13/08/2004 -0300, you wrote:
>Dear Friends
>(IBO registered) / D7 / Interbase 6
>
>I migrate an application from Paradox, and the application run Ok.
>The connection is made with IBODatabase, and I want to replace
>IBODatabase with Ib_Connection/IB_Transaction.
>These components are in the MainForm (not in Datamodule). Delphi can
>compile the application without errors, but when the application is
>executed, before the create Event of the MainForm, I get an AV.
>Debugging with F8, the AV is generated in IB_components (in function
>TIB_Connection.GetSQLDialect: smallint;)
>
>I modified the CreateOrder of these components (to top), withou success.
>Whith the IBODatabase, no errors!
>
>Can you help me?

1. Move the TIBODatabase to the datamodule.

2. Change the order of the CreateForm statements in the DPR unit, so that
the Datamodule is created before the "main" form. This makes the
datamodule the application's main form and ensures that all of the
data-bound controls on the forms have something to refer to when they are
created.

3. Try not to write datamodule methods in forms - where possible, keep
data methods and properties in the datamodule and call them from the forms.

4. It's also a good idea to keep the creation order of data access objects
very neat and tidy, e.g. if you need an explicit TIB_session, create it
first (this is ESSENTIAL); then the connection object; then the "master"
data access objects, then the dependent objects.

Did you know that you can get the equivalent of TIB_Connection +
TIB_Transaction by using TIBODatabase + an explicit TIBOTransaction? Set
the DefaultTransaction of the TIBODatabase to be your TIBOTransaction, then
refer to the transaction object's StartTransaction, Commit, etc.
methods. You might find this an easier way to make the transition from
your old Paradox app.

Helen