This question is locked. New answers and comments are not allowed.
Hi,
I have a stored procedure I'm trying to run using:
Inside the stored proc I try to acquire a Mutex lock with:
When I attempt to run this proc in SQL everything works fine. If I try to run this procedure using OpenAccess I get an error raised with the "Unable to acquire lock" message. Could you please let me know why I cannot acquire the lock and how to achieve this with OpenAccess?
Regards,
Ash
I have a stored procedure I'm trying to run using:
IEnumerable<
int
> actualResults = this.DataSource.Context.ExecuteQuery<
int
>("spCore_AllocateWorkItem", System.Data.CommandType.StoredProcedure,
docNoParam,
docTableParam,
clientHandleParam,
userIdParam,
computerIdParam,
moduleIdParam,
serverIdParam,
whereParam,
orderParam,
maximumResultsParam,
reconnectCodeParam);
Inside the stored proc I try to acquire a Mutex lock with:
EXEC @Result = sys.sp_getapplock
@Resource = 'WorkAllocator',
@LockMode = 'Exclusive',
@LockOwner = 'Session',
@LockTimeout = 20000
IF @Result NOT IN (0,1)
BEGIN
RAISERROR ('Unable to aquire lock', 16,1)
END
When I attempt to run this proc in SQL everything works fine. If I try to run this procedure using OpenAccess I get an error raised with the "Unable to acquire lock" message. Could you please let me know why I cannot acquire the lock and how to achieve this with OpenAccess?
Regards,
Ash