Board index » delphi » Empty Table - Table in use

Empty Table - Table in use

I'm trying to empty a table and keep getting a message that the table is in
use.  The user the error message lists is me.

How can I clear out users so the file can be emptied?

any help will be appreciated.

cg

guav...@aloha.net

 

Re:Empty Table - Table in use


Quote
cg <guav...@hotmail.com> wrote in message

news:hmGm6.106$B82.2643@news.aloha.net...

Quote
> I'm trying to empty a table and keep getting a message that the table is
in
> use.  The user the error message lists is me.

Close the table.

--
Smola
--
"And once again, the day is saved"
(http://supersmola.tripod.com/index.htm)

Re:Empty Table - Table in use


If the table in question is a Paradox one, try deleting the Pdoxusrs.net
file, which you'll probably find on your C drive.  If your table hasn't been
closed properly, eg your application has run into some kind of problem,
Pdoxusrs will assume you're still using it.  The file will be automatically
created next time you use the table.

Quote
cg <guav...@hotmail.com> wrote in message

news:hmGm6.106$B82.2643@news.aloha.net...
Quote
> I'm trying to empty a table and keep getting a message that the table is
in
> use.  The user the error message lists is me.

> How can I clear out users so the file can be emptied?

> any help will be appreciated.

> cg

> guav...@aloha.net

Re:Empty Table - Table in use


Had similar problem a while ago when using EmptyTable.

Emptying the table and then closing with active:=false and exclusive:=true
etc did not actually close the table when I used a Table.Close within a
cancel or ok  button procedure.

Solution I use is to close table in an OnFormClose event.

However, not sure if this will cure your problem in a multi-user situation.

Quote
"cg" <guav...@hotmail.com> wrote in message

news:hmGm6.106$B82.2643@news.aloha.net...
Quote
> I'm trying to empty a table and keep getting a message that the table is
in
> use.  The user the error message lists is me.

> How can I clear out users so the file can be emptied?

> any help will be appreciated.

> cg

> guav...@aloha.net

Re:Empty Table - Table in use


If the table is in a datamodule it will sometimes give you fits.  Place the
table on your form and try it again.

Re:Empty Table - Table in use


On Thu, 8 Mar 2001 20:55:55 +1100, "Robin Dobos"

Quote
<dobo...@ozemail.com.au> wrote:
>Had similar problem a while ago when using EmptyTable.

>Emptying the table and then closing with active:=false and exclusive:=true
>etc did not actually close the table when I used a Table.Close within a
>cancel or ok  button procedure.

You must set active false (or TTable.Close), then Exclusive true, and
then TTable.Empty. If any other user, Database Desctop, your own app,
or other user on network has the table in use (with a TTable or live
query), then you wont get exclusive to go true. In other words, one
user can't get exclusive rights to the whole physical table if any
other user is already using it. I can't imagine any database engine
that whould let one "user" (i.e. any part of a program code) delete
all the records of a table while it is in use.

Quote

>Solution I use is to close table in an OnFormClose event.

This is OK if it is where you really want to close the table, but you
should be able to do the same thing in a button click or anywhere else
in code.

HTH,
Dan

Quote
>However, not sure if this will cure your problem in a multi-user situation.

>"cg" <guav...@hotmail.com> wrote in message
>news:hmGm6.106$B82.2643@news.aloha.net...
>> I'm trying to empty a table and keep getting a message that the table is
>in
>> use.  The user the error message lists is me.

>> How can I clear out users so the file can be emptied?

>> any help will be appreciated.

>> cg

>> guav...@aloha.net

--
Dan Brennand
CMDC systems, inc.
Configuration Management and Document Control:
visit us at www.cmdcsystems.com
[SPAM block: change at to @ in my e-mail address]

Re:Empty Table - Table in use


On Thu, 8 Mar 2001 11:40:30 -0500, "Tom Payne" <tdpa...@ix.netcom.com>
wrote:

Quote
>If the table is in a datamodule it will sometimes give you fits.  Place the
>table on your form and try it again.

It should make no difference where the TTable object is. Before you
can empty it with TTable.Emply, you must have exclusive rights with
that particular TTable. To do that, there must be no other TTable or
live TQuery active on the physical table.

Dan

Quote

--
Dan Brennand
CMDC systems, inc.
Configuration Management and Document Control:
visit us at www.cmdcsystems.com
[SPAM block: change at to @ in my e-mail address]

Re:Empty Table - Table in use


I've tried a few tests, and it looks like you have to set the TTable's
Active property to false in the Object Inspector if you're running the
application from the IDE.  Item 477 under BDE in the Delphi Bug List,
http://buglist.jrsoftware.org/bugsall.htm confirms this, though I'm not
convinced that this is actually a bug; more likely the BDE sees the IDE as
another user.

Quote
Dan Brennand <D...@CMDCsystems.com> wrote in message

news:3aa8001f.450195816@news.dimensional.com...
Quote
> On Thu, 8 Mar 2001 20:55:55 +1100, "Robin Dobos"
> <dobo...@ozemail.com.au> wrote:

> >Had similar problem a while ago when using EmptyTable.

> >Emptying the table and then closing with active:=false and
exclusive:=true
> >etc did not actually close the table when I used a Table.Close within a
> >cancel or ok  button procedure.

> You must set active false (or TTable.Close), then Exclusive true, and
> then TTable.Empty. If any other user, Database Desctop, your own app,
> or other user on network has the table in use (with a TTable or live
> query), then you wont get exclusive to go true. In other words, one
> user can't get exclusive rights to the whole physical table if any
> other user is already using it. I can't imagine any database engine
> that whould let one "user" (i.e. any part of a program code) delete
> all the records of a table while it is in use.

> >Solution I use is to close table in an OnFormClose event.

> This is OK if it is where you really want to close the table, but you
> should be able to do the same thing in a button click or anywhere else
> in code.

> HTH,
> Dan
> >However, not sure if this will cure your problem in a multi-user
situation.

> >"cg" <guav...@hotmail.com> wrote in message
> >news:hmGm6.106$B82.2643@news.aloha.net...
> >> I'm trying to empty a table and keep getting a message that the table
is
> >in
> >> use.  The user the error message lists is me.

> >> How can I clear out users so the file can be emptied?

> >> any help will be appreciated.

> >> cg

> >> guav...@aloha.net

> --
> Dan Brennand
> CMDC systems, inc.
> Configuration Management and Document Control:
> visit us at www.cmdcsystems.com
> [SPAM block: change at to @ in my e-mail address]

Other Threads