I am new to SDAC and SQL Server.
The option to lock a table for bulk update is very useful.
When another instance of my application tries to open the table, how can I detect that the table has a lock placed on it by another user before calling Open.
Calling open and displaying the lock timeout error message seems messy. Delphi only hands back an standard Exception so there are no error codes to analyse which means I would have to detect that the string contained the lock timeout message.
Is there a better way?
Delphi XE7 SDAC Table Locking
Re: Delphi XE7 SDAC Table Locking
You can handle this error ( http://www.microsoft.com/technet/suppor ... SSQLServer ) by the error code in a try ... except block using EMSError exceptions. The error code value is stored in the EMSError.MSSQLErrorCode property. For example:
Code: Select all
try
MSQuery.Open;
except
on E:EMSError do
begin
if E.MSSQLErrorCode = 1222 then
// DoSomething;
...
end;
end;