Although its hidden the form you were working on in Delphi is still sitting
there, with the table open. If you close Delphi, and run your .exe directly,
you'll find the problem goes away. The other option is to close that form
before running the application from within Delphi, or (the recommended
option) once you have set up your tables etc, make sure that they are closed
on the design time form.

Regards,
  Andrew Cooke.

> -----Original Message-----
> From: John Christenhusz [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, April 08, 1999 9:02 AM
> To:   Multiple recipients of list delphi
> Subject:      Table busy
> 
> Hi all,
> 
> I've got the following problem:
> I create a copy table, using the following code
>       with tblSource do
>       begin
>          databaseName := sDBaseName;
>          tableName    := sSourceTableName;
>       end;
> 
>       with tblDest do
>       begin
>          databaseName := sDbaseName;
>          tableName    := sDestTableName;
>       end;
> 
>       with tblDest do
>       try
>          tblSource.fieldDefs.update;
>          fieldDefs.assign(tblSource.fieldDefs);
>          tblSource.IndexDefs.update;
>          indexDefs.assign(tblSource.indexDefs);
>          createTable; // create clone table
> 
> This works fine, unless I leave the destination table (component) open at
> design time. No hold on, I do shut all the tables at OnCreate() by the
> following code:
>    // close all tables
>    for i := 0 to componentCount-1 do
>    begin
>       try
>          if components[i] is TTable then
>          with TTable(components[i]) do
>          begin
>             close;
>             dataBaseName := sMainDbaseName;
>          end;
> 
> Summarised:
> All tables are inactive at the time the table in question is to be cloned.
> When the table component connected to the clone table is open at
> design-time the error message "Table is busy" is generated. When the table
> is closed at design-time there is not problem at all.
> 
> Any ideas?
> 
> TIA
> 
> John Christenhusz
> POSTEC DATA SYSTEMS Ltd.
> PO Box 302-230
> Auckland, New Zealand
> E-mail: [EMAIL PROTECTED]
> Phone: 09-415.8803
> Fax: 09-415.9042
> 
> 
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to