Locking a table row
Posted: Tue 10 Dec 2013 17:52
All,
My object is to avoid ungraceful exception handling during record edit in SQL Server.
I want both to recover from a locking error, and to retry or wait a period of time if somehow editing fails in my program.
I have seen some example code snippets but so far none I have found are explicit enough to get me on the right track.
My question:
Suppose I select pessimistic locking on a TMSTable component connected to my SQL table.
I then try to put the dataset into edit mode.
...
MyTable.Edit;
...
But another app somewhere currently has the record in edit mode, or locked, or otherwise unavailable.
What happens in my program when I initiate the edit?
Will it throw an error?
Will it wait for a timeout?
Something else?
Thanks,
Mark
My object is to avoid ungraceful exception handling during record edit in SQL Server.
I want both to recover from a locking error, and to retry or wait a period of time if somehow editing fails in my program.
I have seen some example code snippets but so far none I have found are explicit enough to get me on the right track.
My question:
Suppose I select pessimistic locking on a TMSTable component connected to my SQL table.
I then try to put the dataset into edit mode.
...
MyTable.Edit;
...
But another app somewhere currently has the record in edit mode, or locked, or otherwise unavailable.
What happens in my program when I initiate the edit?
Will it throw an error?
Will it wait for a timeout?
Something else?
Thanks,
Mark