Solved

Table is Busy !?!

Posted on 1998-12-25
13
1,650 Views
Last Modified: 2008-02-26
****
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
Comment
Question by:p05010
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
  • +2
13 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1352964
hi p05010,

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

Zif.
0
 
LVL 1

Expert Comment

by:slautin
ID: 1352965
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
 
LVL 1

Author Comment

by:p05010
ID: 1352966
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:p05010
ID: 1352967
Can somebody send me an example program to try it on my nt4 platform ?
peter.boons@ping.be
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1352968
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
 
LVL 1

Author Comment

by:p05010
ID: 1352969
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1352970
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
 
LVL 1

Author Comment

by:p05010
ID: 1352971
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
 
LVL 5

Expert Comment

by:ronit051397
ID: 1352972
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
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 1352973
hi p05010,

i wish you good luck for your project and

of course

a happy new year

meikl
0
 
LVL 1

Author Comment

by:p05010
ID: 1352974
A happy new year to you all.

Bye
0
 
LVL 1

Expert Comment

by:slautin
ID: 1352975
//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
 
LVL 1

Author Comment

by:p05010
ID: 1352976
Thx for the mail Slautin.

Bye,
P05010
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question