Record-/table-locking
Posted: Tue 01 May 2012 14:26
SQL Server 2008, UniDac-components.
I have to deliver a unique value (as a document-number with a specific format). So my idea is to lock a record (or the whole table), to read then last value, to modify it and to unlock the record / table. I tried it with
try
Connection.StartTransaction
Table.Open
Table.Lock
do by job
Table.Unlock
Table.Close
except
Showmessage('Sorry, table is locked ...');
end;
To test it I made two buttons, two tables and the code above in the OnClick-Event for each table. But there is never an excption fired. How to do it? Thanks for your help, Peter
I have to deliver a unique value (as a document-number with a specific format). So my idea is to lock a record (or the whole table), to read then last value, to modify it and to unlock the record / table. I tried it with
try
Connection.StartTransaction
Table.Open
Table.Lock
do by job
Table.Unlock
Table.Close
except
Showmessage('Sorry, table is locked ...');
end;
To test it I made two buttons, two tables and the code above in the OnClick-Event for each table. But there is never an excption fired. How to do it? Thanks for your help, Peter