• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1976
  • Last Modified:

Table is Busy !?!

****
Project BatchRender.exe raised exception class EDBEngineError with message 'Table is busy. Table: C:\DATA\BATCHRENDER\SPOOL.DB User:Boons'. Process stopped.
****

This is the code I used:
----
Procedure EmptySpoolTable;
Begin
  With BatchRenderForm.TableSpool do
    Begin

   Close;
   DatabaseName:='SpoolBatchRender';
   TableName := 'spool.db';
   TableType := ttDefault;
**   DeleteTable; ** This is the line that caused the error.
      Active:=True;
   Close;

   DatabaseName := 'SpoolBatchRender';
   TableName := 'spool.db';
   TableType := ttDefault;
   CreateTable;
   Active:=True;

    end;
End;
----

How Can I Delete a database (table) at startup of my program ?
Do I miss Something ?
0
p05010
Asked:
p05010
  • 6
  • 3
  • 2
  • +2
1 Solution
 
ZifNabCommented:
hi p05010,

why don't you just use EmptyTable? Then you even don't have to create the table anymore.

Zif.
0
 
slautinCommented:
1.
   DatabaseName:='SpoolBatchRender';
   TableName := 'spool.db';
   TableType := ttDefault; ttParadox - why not
   DeleteTable;
   Active:=True; ??? Why
   Close;
2. Verify next users, who use your database.
3. Use EmptyTable.
4. Use try ... except modules
5. I specially create test program like your and hasn't problems.
   For answer I must have more information.
6. Mail to me for details testing.
0
 
p05010Author Commented:
Hello Slautin, ZifNab,

I've tried different solutions, i.e. EmptyTable,
but it doesn't work, I've get always that annoying error.
This Error always appears just after the executing of DeleteTable (or Empty Table).
I've searched for older solutions mentioned at experts-exchange and I've found some related problems like mine. I'm working on a NT4 system with NO extra users. The older solutions explain that NT4 keep track of the program that's using a particular file (like a DB file). One of the solutions was to close the database or all the connections to that file. So if I do that, there's no program that uses that file at the moment.
And How can I do That ???
Look for "Paradox Table in a directory under windows NT" (answered by kretsschmar) and "Updating a Paradox record" (answered by rpetruni).
Can you give an example of How I can disconnect all the table connection with a buttonclick. Erase the database (db file) and restore the connections ?

By,
P05010
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
p05010Author Commented:
Can somebody send me an example program to try it on my nt4 platform ?
peter.boons@ping.be
0
 
kretzschmarCommented:
hi p05010,

first you should use emptytable instead deletetable, its faster than createtable after deletetable.

your problem seems that there is an connect open to your table with an other tablecomponent. Check all your tablecomponents that points to this table.

to disconnect all your tables with one statement you can use the databasecomponent. the databasename of your tablecomponents should then pointed to the databasecomponent. with the statement databasecomponentname.conntected := false all table- and querycomponents will be closed which pointed to this databasecomponent.

meikl
0
 
p05010Author Commented:
Kretzschmar,

I've used your solution and but it didn't work directly.
I've used the following code.

Procedure EmptySpoolTable;
var DatabaseNaam:Tdatabase;
Begin
  With BatchRenderForm.TableSpool do
    Begin

      Active:=False;
      BatchRenderForm.DataBaseBRSpool.Connected:=False;
      EmptyTable;
      BatchRenderForm.DataBaseBRSpool.Connected:=True;
      Active:=True;

    end;
End;

I can only test this when delphi is closed and when I've run the program from the explorer. That's the only way the program empties the table and that it not post an error on the screen. It seems that the Delphi environment has an instance to that .DB file and NT recognize this like a file that's curently open by another program. SO that little thing is BUSY at the moment.
I even tried it with HandleShared property set to yes.
Who from you guys is also developping delphi applications under NT ? Do you experience the same problems ?

Now I've one big problem, I cannot put the above source in the Oncreateform event so that the database is emptied every time you start the program (under the delphi environment I mean).

Help !
p05010

0
 
kretzschmarCommented:
ok p05010,

i think i see your problem, its no problem of NT, i've the same under win95.

in designmode all tables should be closed. in the oncreate-event of your form open the table and empty it.

example

procedure TForm1.FormCreate(Sender: TObject);
begin
  table1.open;
  table1.EmptyTable;
end;


meikl

0
 
p05010Author Commented:
Hello kretzschmar,

I've just want to mail that I've found the solution you described above. I've set the table.active to false in designtime and the database connoection to false.
In the form's oncreate handler I've put the following code:
  BatchRenderForm.DataBaseBRSpool.Connected:=True;
  BatchRenderForm.TableSpool.Active:=True;

And yes it works.
Hey, many thks for the good ideas.
Please answer the question ...
Bye,
P05010
0
 
ronit051397Commented:
Before deleting a table do the following:
1. Verify that the table is not opened in another application.
2. Close the Table and write:  Table1.Exclusive:=True;
If this doesn't help then:
1. Verfiy that you are disconnected from the database.
2. Delete the file  Pdoxusrs.net
   This file will be recreated automatically by the BDE when it's needed.
0
 
kretzschmarCommented:
hi p05010,

i wish you good luck for your project and

of course

a happy new year

meikl
0
 
p05010Author Commented:
A happy new year to you all.

Bye
0
 
slautinCommented:
//I test this module by D2.0. - all right !

Procedure EmptySpoolTable;   // read everythings about OOP, OOD!
                             // (G.Booch for example ).
                             // it must be class method !
var DatabaseNaam:Tdatabase;  // becouse you use class property -
                             //TableSpool
                             // it's as ABC of OO Languages
Begin
  With BatchRenderForm.TableSpool do
    Begin

   // My recomendations:
   // use fields and columns editor for TableSpool
   // be carifully in coding... where your comments? :-)

   if not Active then
       Open; // for columns set
             // if you use fields and columns editor for
             //TableSpool
             // don't call this method !
   Close;
   //DatabaseName:='SpoolBatchRender'; - not requered
   //                                    it's allready present
   //TableName := 'spool.db';
   //TableType := ttParadox;
   EmptyTable;

   {OpenDatabase(BatchRenderForm.DatabaseSpool);}
   //DatabaseName := 'SpoolBatchRender';
   //TableName := 'spool.db';
   //TableType := ttDefault;
   Open;
   //Active:=True;

    end;
End;
0
 
p05010Author Commented:
Thx for the mail Slautin.

Bye,
P05010
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now