Board index » delphi » Lock Access table prior to ALTER TABLE

Lock Access table prior to ALTER TABLE

When executing the following I get an error like 'Couldn't lock table XXX,
currently in use'

  Server.SQL.Add('ALTER TABLE '+TabName);
  Server.SQL.Add('ADD COLUMN '+FieldName+FieldType);

What can I do to lock table?

Thanks Ramzi Fadel

 

Re:Lock Access table prior to ALTER TABLE


Ramzi,
In addition to making sure there are no other network users that might
have the table open, have you checked to be sure that it is not open
in the IDE? If you set Active true in the Object inspector for a
TTable or TQuery, and then run the app from Delphi, then Delphi itself
will be a separate user, and you can't get exclusive access to the
table.
HTH,
Dan

Quote
On Thu, 02 Sep 99 09:12:59 GMT, r...@vki.dk (Ramzi Fadel) wrote:
>When executing the following I get an error like 'Couldn't lock table XXX,
>currently in use'

>  Server.SQL.Add('ALTER TABLE '+TabName);
>  Server.SQL.Add('ADD COLUMN '+FieldName+FieldType);

>What can I do to lock table?

>Thanks Ramzi Fadel

--
Dan Brennand
CMDC systems, inc.
Configuration Management and Document Control: Consulting, Software,
and the only comprehesive textbook on this subject.
visit us at www.cmdcsystems.com
[Remove the SPAM from my e-mail address]

Re:Lock Access table prior to ALTER TABLE


Quote
Ramzi Fadel wrote in message <7qlf2c$1gr...@news.net.uni-c.dk>...
>When executing the following I get an error like 'Couldn't lock table XXX,
>currently in use'

>  Server.SQL.Add('ALTER TABLE '+TabName);
>  Server.SQL.Add('ADD COLUMN '+FieldName+FieldType);

>What can I do to lock table?

>Thanks Ramzi Fadel

set exclusive to true

maverick

Other Threads