Board index » delphi » EMPTY TABLE /TABLE EXCLUSIVE PROBLEMS

EMPTY TABLE /TABLE EXCLUSIVE PROBLEMS

I am trying to empty a table in an app but am getting an error trying
to get the table into exclusive mode.

        My code is as follows:

        Try
          Datamodule1.TBInv.Active:=False;
          Datamodule1.TBInv.Exclusive:=True;
          Datamodule1.TBInv.Active:=True;    
          Datamodule1.TBInv.EmptyTable;
          Datamodule1.TBInv.Active:=False;
          Datamodule1.TBTempInv.Active:=False;
        Except
          Showmessage('Error on Empty Table');
        End;

        My code fails on the Datamodule1.TBInv.Active:=True Line. It is as if
the datasource was never set to false, etc. I have only one Datasource
for this table. However, several forms display data from this table.

        What is wrong here ??? Do I need to disable the controls who normally
display the data through the datasource first ???

        Thank you for your help.

Neil Huhta

 

Re:EMPTY TABLE /TABLE EXCLUSIVE PROBLEMS


If the table is active in design mode an attempt open exclusive at run time will
fail.

Steve Griffiths

Quote
nhuhta wrote:
> I am trying to empty a table in an app but am getting an error trying
> to get the table into exclusive mode.

>         My code is as follows:

>         Try
>           Datamodule1.TBInv.Active:=False;
>           Datamodule1.TBInv.Exclusive:=True;
>           Datamodule1.TBInv.Active:=True;
>           Datamodule1.TBInv.EmptyTable;
>           Datamodule1.TBInv.Active:=False;
>           Datamodule1.TBTempInv.Active:=False;
>         Except
>           Showmessage('Error on Empty Table');
>         End;

>         My code fails on the Datamodule1.TBInv.Active:=True Line. It is as if
> the datasource was never set to false, etc. I have only one Datasource
> for this table. However, several forms display data from this table.

>         What is wrong here ??? Do I need to disable the controls who normally
> display the data through the datasource first ???

>         Thank you for your help.

> Neil Huhta

Re:EMPTY TABLE /TABLE EXCLUSIVE PROBLEMS


Are you testing this program from inside the IDE?  If so and if you
have the table open at design time then the IDE also has the table
open and that is why your app cannot get an exclusive lock.

Bill

(Sorry but TeamB cannot answer support questions received via email.              )
(To send me email for any other reason remove .nospam from my address.)

Re:EMPTY TABLE /TABLE EXCLUSIVE PROBLEMS


Others have suggested possible solutions (ie, table active at design time).  I
would just note that I have received this message from time to time even though
my table is not active at design time.  Ususally it happens inside the IDE and
only after I have had an abend in my code.  The next time I try to run I get the
message and nothing will make it go away.  The only way I can get it to work
properly again is to close and restart Delphi.

Quote
nhuhta wrote:
> I am trying to empty a table in an app but am getting an error trying
> to get the table into exclusive mode.

--
Wayne Herbert
Manager, Computer Products
Key Maps, Inc.
1411 West Alabama
Houston, TX  77006

Vox:  713.522.7949
Fax:  713.521.3202
Email:  wherb...@rice.edu

"Why is it only drug dealers and software developers call their clients 'users'?"

Re:EMPTY TABLE /TABLE EXCLUSIVE PROBLEMS


You are correct - I'm running the program from within the IDE. I'll test
this by closing everything out. Thank you for your help.

Sincerely,

Neil Huhta

Quote
Bill Todd (TeamB) wrote:

> Are you testing this program from inside the IDE?  If so and if you
> have the table open at design time then the IDE also has the table
> open and that is why your app cannot get an exclusive lock.

> Bill

> (Sorry but TeamB cannot answer support questions received via email.              )
> (To send me email for any other reason remove .nospam from my address.)

Other Threads