Solved

empty Paradox db

Posted on 1998-05-28
33
703 Views
Last Modified: 2008-02-01
I like to know how to empty a Paradox db without
a iteration in Delphi 3.0, sometime like table1.DELETEALL

Thanks
0
Comment
Question by:miauw
  • 12
  • 10
  • 8
  • +2
33 Comments
 
LVL 2

Expert Comment

by:kjteng
ID: 1348312
table1.emptyTable
0
 

Author Comment

by:miauw
ID: 1348313
Well ofcourse I tried that but, when
I replace my code (which works):
------
while not(HTML.EOF) do
begin  HTML.First; HTML.Edit; HTML.Delete; HTML.Next;end;
 HTML.First; HTML.Edit; HTML.Delete;
------

with HTML.EmptyTable
I get:
Project THIS.exe raised exception class EDBEngineError with
message 'Table cannot be opened for exclusive use.'. Process stopped
Use Step or Run to continue.

The result I get when I use:
HTML.First; HTML.Edit; HTML.emptytable

My program run locally. There are no other users/other programs involded.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1348314
with Table1 do
begin
  Close;
  Exclusive:=True;
  EmptyTable;
  Exclusive;=False;
  Open;
end;
0
 

Author Comment

by:miauw
ID: 1348315
Thanks Ronit, but :

When I replace  
Exclusive;=False with Exclusieve:= False
then still I get an error:

Project THIS.exe raised exception class EDBEngineError with
 message 'Table is busy.
Table: F:\BLA\BLA.DB
User: MyWin95ComputerName
Process stopped   Use Step or Run to continue.
0
 

Author Comment

by:miauw
ID: 1348316
I mean
Exclusive:=False;
0
 
LVL 7

Expert Comment

by:BlackMan
ID: 1348317
If you have multiple TTables pointing to the same Paradox table, you'll have to close them all before setting Exclusive := true
0
 

Author Comment

by:miauw
ID: 1348318
There is just one TTable... there is just one TDataSource..
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1348319
BlackMan is correct, All tables component that point to the same physical table must be closed before changing the exclusive status.
Exclusive:=True means you can only open one "session" of that particular table.
0
 
LVL 2

Expert Comment

by:kjteng
ID: 1348320
Set the exclusive property in object inspector to false.
otherwise the ide will have the exclusive rights on the file.
0
 

Author Comment

by:miauw
ID: 1348321
To Ronit: as I wrote there is just 1 table involded in the entire program.
.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1348322
Is another application opened this table, like the Database DeskTop?
You should close the table also in the othe applications.
0
 

Author Comment

by:miauw
ID: 1348323
I can not change the properties of Exclusive in the Object Expector either.
When I put Active to false, then Exclusive to true, then Active to true:
I get a 'Table busy' either. The program isn't active then (I mean, I didn't
press Run).

When I set Active to False, quit Delphi
and then set  Exclusive to true, Active to False,
I don't get an errormessage right away...
but when press RUN I get:
...same exception class as above...
'File is locked'


0
 

Author Comment

by:miauw
ID: 1348324
Sorry I ment.

When I set active to False, quit Delphi, exclusive to True, active to True...
0
 

Author Comment

by:miauw
ID: 1348325
Again for clarity:
No other program is running accept Delphi.
e.g. Database Desktop is not running.

0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1348326
1. Exit Delphi.
2. Delete the file Pdoxusrs.net, usually located in c:\.
3. Reload Delphi and run your program.( the Pdoxusrs.net will be recreated).
Is it OK now?
0
 
LVL 2

Expert Comment

by:kjteng
ID: 1348327
Is you file stored on lan server. If so may be your pdoxusrs.lck and parodox.lck file is not updated.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:miauw
ID: 1348328
To Kjteng: no it is not on a lan server. I checked too if
 pdoxusrs.lck and parodox.lck were present on my HD's: NO.

To RoNit
C:\ contained PDOXUSRS.NET . I renamed it.

this is sequential:

Attempt 1:
Quit Delphi, rename C:\PDOXUSRS.NET to garbage.txt
Started Delphi.
Table1 Object Inspector: Exclusive: NO Active Yes
Pressed Run:  'Table is busy error''
After this C:\ contained PDOXUSRS.NET .

Attempt 2:
Quit Delphi. Set Active to No,
Set Exclusive to Yes. Set Active to Yes:
No error message this time (see above) at the point
of changing Set Active to Yes.
When I pressed Run I got the error: ....File is locked..
Run or Step to continu.

Attempt 3:
Set Active to No (exclusive was set to Yes remember).
Quit Delphi, rename C:\PDOXUSRS.NET to garbage.txt
Started Delphi. Set Active to yes  (exclusive was set to Yes remember)
same error as in attempt 2. (....File is locked..)

I am getting very depressed right now,
remember that the slow iteration:
while not(HTML.EOF) do
       begin  HTML.First; HTML.Edit; HTML.Delete; HTML.Next;end;
        HTML.First; HTML.Edit; HTML.Delete;
still DOES WORK perfectly.

Please give me accept guideliness as to do what in which order,
I am loosing hours here. I will raise the point by 200.









0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1348329
Let's go step by step:
1. This is from Delphi Help File:

Use Exclusive to prevent other applications from accessing a Paradox or dBASE table while this application is using it. Before opening the table, set Exclusive to True.
When Exclusive is True, then when the application successfully opens the table, no other application can access it. If the table for which the application has requested exclusive access is already in use by another application, an exception is raised. To handle such exceptions, write an exception handler.

A table must be closed before changing the setting of the Exclusive property. Do not set Exclusive to True at design time if you also intend to set the Active property to True at design time. In this case an exception is raised because the table is already in use by the IDE.

2. Delete again PDOXUSRS.NET.
3. Restart Windows.
4. Create a new clean application and post a TTable on the from.
5. Set the following properties at design:
    Exclusive:=False;
    Active:=True;
6. Place a button and write the OnClick event:
with Table1 do
     begin
       Close;
       Exclusive:=True;
       EmptyTable;
       Exclusive;=False;
       Open;
     end;
7. activate the application and press the button to empty the table.
If this does not work, then send me the project and the table by EMail, and I'll check it.

0
 
LVL 2

Expert Comment

by:kjteng
ID: 1348330
No. DON'T set the active in object inspector to True.

set active to false,
write code to set table1.active to true in your program
save the project, quit delphi;
delete C:\PDOXUSRS.NET;
start delphi again
run

alternatively, quit delphi, run you exe from windows without IDE.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1348331
S/He can set the Active to True as long as the exclusive is false.
0
 

Author Comment

by:miauw
ID: 1348332
Thanks, I will try both. Soon.
I have only 1 request:

 >  Create a new clean application and post a TTable on the from.

NO! The point being I must get this app. to run, not a brand
new one.
0
 
LVL 2

Expert Comment

by:kjteng
ID: 1348333
agreed.
The thing is getting strange... may be s/he need a rest.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1348334
Who needs a rest?
0
 
LVL 2

Expert Comment

by:kjteng
ID: 1348335
miauw  ... I also have been in such situtation before and usually i found my mistake after taking a nap

0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1348336
In these cases I usually use the Elimination Method.
The reason I want to see if it works on a clean application is to verify that you are writing the right code and that the BDE files work OK.
0
 

Author Comment

by:miauw
ID: 1348337
Thanks for your advise Kjteng, but let us discuss my Delphi program here
and not the way I spend my time
.
I have followed Ronit instructions:
1- I deleted c:\pdoxusrs.net (the only pdoxusrs.net on my HD)
2- I restarted Windows
3- I put a table on the form, first setting active to false (and exclusive to false).
4- I inserted the code
with Table1 do
            begin
              Close;
              Exclusive:=True;
              EmptyTable;
              Exclusive:=False;
              Open;
            end;
in a button.OnClick procedure and table1 being the same as
in the program which all this is ment for.

5- Ran the program: no errors.

6- Now I changed with the Object Inspector the table prop Active to True as RonIt
    suggested:

Again ERROR: the table is busy.

7- I ran the program .EXE from the Explorer. No errors at all.


0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1348338
I had once also this problem with a paradox database. When I restarted WINDOWS the problem was solved. Another time I just removed the database and rewrote the table. This worked too. I don't know where the problem came from, but they usely appear when something goes wrong testing it. And then I think the paradox tables aren't closed correctly.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1348339
OK, I have checked it and the Active=True in the design time causes the problem although it shoudn't, therefore if you want to see the Table records prior to deleting it, write:
procedure TForm1.FormCreate(Sender: TObject);
begin
  table1.Open;
end;

0
 
LVL 2

Expert Comment

by:kjteng
ID: 1348340
5- Ran the program: no errors ...  You mean the table is empty now? And the error message only come out when you try to set the active property at design time?  
0
 
LVL 2

Expert Comment

by:kjteng
ID: 1348341
I tried  on my pc those steps you have done. No error.
However I am using D1.
Let me go home to try on another pc which have d3 installed in it.
You may also send you code to me at gjdeng@yahoo.com

Bye
0
 

Author Comment

by:miauw
ID: 1348342
The problem is solved now.

The Delphi Programming environment gives the problem.

I set active to false, and in form.show set it to true : again an error.

Then as suggested by Zipnab, I booted Win again, and after that it worked
but with only active set to false....

The setting of Exclusive didn't matter at all, both true and false = ok. The existence
of c:\pdoxusrs.net was irrelevant too, in this case.

In all onesty I think Kjteng gave me the best clue how to solve
the problem, but after I solved the problem myself I red RonIt last comment,
which is to the point.
So either Kjteng or RonIt submit your comment as a answer, so this
question can be closed.



0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 250 total points
ID: 1348343
OK.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1348344
Hi miauw, I fully agree with your comment. Have a nice day. c.u. ZiF.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now