MDI application with database - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

MDI application with database

ziki3ziki3 Posts: 1Member
Hi!
I'm making a MDI application with IB database components and packages.
I show the form from the package with a function like:
...
type TShowChild: procedure(db: TIbDatabase; tr: TIbTransaction);
var ShowChild: TShowChild;
ShowChild(IbDatabase1,IbTransaction1);
...

in the form's unit:
...
var db0: TIbDatabase, tr0: TIbTransaction;
...
procedure TFormChild.ShowChild(db: TIbDatabase; tr: TIbTransaction);
begin
db0 := db;
tr0 := tr;
IbQuery1.Database := db0;
IbQuery1.Transaction := tr0;
...

The program works fine, but when I close the MDI child form,
he releases the IbDatabase1 and the IbTransaction1.

Any suggestion??

Comments

  • malackamalacka Posts: 31Member
    : Hi!
    : I'm making a MDI application with IB database components and packages.
    : I show the form from the package with a function like:
    : ...
    : type TShowChild: procedure(db: TIbDatabase; tr: TIbTransaction);
    : var ShowChild: TShowChild;
    : ShowChild(IbDatabase1,IbTransaction1);
    : ...
    :
    : in the form's unit:
    : ...
    : var db0: TIbDatabase, tr0: TIbTransaction;
    : ...
    : procedure TFormChild.ShowChild(db: TIbDatabase; tr: TIbTransaction);
    : begin
    : db0 := db;
    : tr0 := tr;
    : IbQuery1.Database := db0;
    : IbQuery1.Transaction := tr0;
    : ...
    :
    : The program works fine, but when I close the MDI child form,
    : he releases the IbDatabase1 and the IbTransaction1.
    :
    : Any suggestion??
    :


    i think the problem is with this line:
    [b]db0:=db;[/b]

    I never worked with IB tables but this doesn't work with simple tables too.

    let's suppose u have Table1 and Table2

    U set Databasename and TableName property to Table1
    then Table2:=Table1;
    And if u write Table2.Active:=false it closes the Table1 too
    because both variables point to the same place in memory.
    So u should just transfer the needed properties like Databasename and Tablename and u know what else - i don't :-)


Sign In or Register to comment.