Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Table is Busy !?!

Posted on 1998-12-25
13
Medium Priority
?
1,779 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 150 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

704 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