p05010
asked on
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:='SpoolBatchR ender';
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 ?
Project BatchRender.exe raised exception class EDBEngineError with message 'Table is busy. Table: C:\DATA\BATCHRENDER\SPOOL.
****
This is the code I used:
----
Procedure EmptySpoolTable;
Begin
With BatchRenderForm.TableSpool
Begin
Close;
DatabaseName:='SpoolBatchR
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 ?
1.
DatabaseName:='SpoolBatchR ender';
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.
DatabaseName:='SpoolBatchR
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.
ASKER
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
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
ASKER
Can somebody send me an example program to try it on my nt4 platform ?
peter.boons@ping.be
peter.boons@ping.be
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.conn tected := false all table- and querycomponents will be closed which pointed to this databasecomponent.
meikl
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.conn
meikl
ASKER
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.DataBaseBR Spool.Conn ected:=Fal se;
EmptyTable;
BatchRenderForm.DataBaseBR Spool.Conn ected:=Tru e;
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
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
Begin
Active:=False;
BatchRenderForm.DataBaseBR
EmptyTable;
BatchRenderForm.DataBaseBR
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
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
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
ASKER
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.DataBaseBR Spool.Conn ected:=Tru e;
BatchRenderForm.TableSpool .Active:=T rue;
And yes it works.
Hey, many thks for the good ideas.
Please answer the question ...
Bye,
P05010
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.DataBaseBR
BatchRenderForm.TableSpool
And yes it works.
Hey, many thks for the good ideas.
Please answer the question ...
Bye,
P05010
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
A happy new year to you all.
Bye
Bye
//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:='SpoolBatc hRender'; - not requered
// it's allready present
//TableName := 'spool.db';
//TableType := ttParadox;
EmptyTable;
{OpenDatabase(BatchRenderF orm.Databa seSpool);}
//DatabaseName := 'SpoolBatchRender';
//TableName := 'spool.db';
//TableType := ttDefault;
Open;
//Active:=True;
end;
End;
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
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:='SpoolBatc
// it's allready present
//TableName := 'spool.db';
//TableType := ttParadox;
EmptyTable;
{OpenDatabase(BatchRenderF
//DatabaseName := 'SpoolBatchRender';
//TableName := 'spool.db';
//TableType := ttDefault;
Open;
//Active:=True;
end;
End;
ASKER
Thx for the mail Slautin.
Bye,
P05010
Bye,
P05010
why don't you just use EmptyTable? Then you even don't have to create the table anymore.
Zif.