Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.