Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
MDI application with database Posted by ziki3 on 1 Aug 2003 at 12:05 PM
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??
Report
Re: MDI application with database Posted by malacka on 1 Aug 2003 at 1:40 PM
: 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:
db0:=db;

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





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.