K
KennethK
Guest
I have written an ActiveX control using OLE DB for an MSSQL db. I previously used the MS provided ADODB.Recordet control to perform a SELECT within a transaction on a table with the following table hints (
ROWLOCK, UPDLOCK, NOWAIT). Using this statement, when the first user selected the row to update it, any other users attempting to select the row would receive a timeout error indicating that the row was already locked. Due to operational constraints I can no longer use the ADODB controls so I had to roll my own. When using OLEDB ATL, a CCommand object executes the SELECT statement and locates the row. I use CRowset->MoveNext() to test if the row was actually found and locked during a transaction. The problem comes when the a second user attempts to SELECT the same record. A call to CRecordSet->MoveNext() returns E_FAIL. I can't tell whether the provider detected an error or a timeout occurred What is the best way to implement concurrency checking using ole db and MSSQL?
Kenney
Continue reading...
ROWLOCK, UPDLOCK, NOWAIT). Using this statement, when the first user selected the row to update it, any other users attempting to select the row would receive a timeout error indicating that the row was already locked. Due to operational constraints I can no longer use the ADODB controls so I had to roll my own. When using OLEDB ATL, a CCommand object executes the SELECT statement and locates the row. I use CRowset->MoveNext() to test if the row was actually found and locked during a transaction. The problem comes when the a second user attempts to SELECT the same record. A call to CRecordSet->MoveNext() returns E_FAIL. I can't tell whether the provider detected an error or a timeout occurred What is the best way to implement concurrency checking using ole db and MSSQL?
Kenney
Continue reading...