Discussion:
Cannot set table in exclusive use
(too old to reply)
Stark
2010-06-29 15:53:44 UTC
Permalink
I added a Table to an application and I need to pack it. It is a dBase table
and must be set in exclusive use. I never get to pack it, since the Open
fails and I found out that i t doesn't if I remove the statement
'exclusive:= true'.
Of cours,e removing the statement makes the program fail in the packing that
wants the table to be in exclusive mode.
What is it that may prevent the table to be set exclusive ? I am using a
normal TTable component with Delphi2007. The pack is the first thing in the
program, just after setting the Table databasename.
ap
2010-06-29 17:18:22 UTC
Permalink
Post by Stark
The pack is the first thing in the
program, just after setting the Table databasename.
Can't you show even a tiny glimpse what kind of code you are using when
trying to Pack your table?

If memory serves me, BDE + dBase does not offer any staraightforwarded
'Pack' command or method to do the packing.

You'll have to do it by DBI calls, dbiPackTable or something, and there
you can easily write something wrong. If you do no just directly take
and use any of those ready made examples there are in several places...
-ap
Stark
2010-06-29 21:10:13 UTC
Permalink
Post by ap
Post by Stark
The pack is the first thing in the
program, just after setting the Table databasename.
Can't you show even a tiny glimpse what kind of code you are using when
trying to Pack your table?
If memory serves me, BDE + dBase does not offer any staraightforwarded
'Pack' command or method to do the packing.
You'll have to do it by DBI calls, dbiPackTable or something, and there
you can easily write something wrong. If you do no just directly take
and use any of those ready made examples there are in several places...
-ap
I have been working on this problem the whole afternoon with no success.
I abandoned for dinner and now (11:00 pm) I tried again to follow execution
of each single statement with the debug.
Surpise! It works. I have changed nothing. A few hours ago the table Open
statement failed raising an exception and therefore skipping the dbiPack.
Now the same set of statement works. I am sure it has something to do with
the Table status in the system, but I had already tried to exit delphi and
reenter ...
Paul E. Schoen
2010-07-07 20:36:51 UTC
Permalink
Post by Stark
Post by ap
Post by Stark
The pack is the first thing in the
program, just after setting the Table databasename.
Can't you show even a tiny glimpse what kind of code you are using when
trying to Pack your table?
If memory serves me, BDE + dBase does not offer any staraightforwarded
'Pack' command or method to do the packing.
You'll have to do it by DBI calls, dbiPackTable or something, and there
you can easily write something wrong. If you do no just directly take
and use any of those ready made examples there are in several places...
-ap
I have been working on this problem the whole afternoon with no success.
I abandoned for dinner and now (11:00 pm) I tried again to follow
execution of each single statement with the debug.
Surpise! It works. I have changed nothing. A few hours ago the table Open
statement failed raising an exception and therefore skipping the dbiPack.
Now the same set of statement works. I am sure it has something to do with
the Table status in the system, but I had already tried to exit delphi and
reenter ...
I had a similar problem with my attempt to update a new table with data from
an old table. I'm not sure exactly where it failed or how I got it to work,
but I may have had the table open in another application, or possibly the
BDE had failed after I tried using the Database Desktop under Vista, which
required a restart to get it working again. I'm using D4 Pro.

I think the usual controls in the DBNavigator actually deletes a row rather
than marking for later deletion, so packing is automatic. But the
DatabaseDesktop may just mark for deletion until you explicitly pack the
table.

Paul
BRoberts
2010-07-08 00:40:52 UTC
Permalink
Post by Stark
I added a Table to an application and I need to pack it. It is a dBase
table and must be set in exclusive use. I never get to pack it, since the
Open fails and I found out that i t doesn't if I remove the statement
'exclusive:= true'.
Of cours,e removing the statement makes the program fail in the packing
that wants the table to be in exclusive mode.
What is it that may prevent the table to be set exclusive ? I am using a
normal TTable component with Delphi2007. The pack is the first thing in
the program, just after setting the Table databasename.
The most likely cause is that the table is open elsewhere. I found this
quite tricky with Delphi. Make sure that any table component that references
the actual disk table is closed in the designer before doing a build. Make
sure that you have no code that opens the table explicitly in the
constructors (OnCreate) of automatically created forms. Make sure that you
have no code that implicitly creates (report writers are often culprits) in
the constructors of automatically created forms.

Loading...