ODBC pessimistic lock
ODBC pessimistic lock
От:
"Marian Naghen" <naghen@ratb.ro>
Дата:
How can I aquire pessimistic locking using MFC ODCB classes ?
I used this code but no exception is raising on the second process.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CString sSQL = "SELECT * FROM table_1 WHERE table_id = 1 FOR UPDATE";
// open recordset:try{
if(!m_pSet->IsOpen()){
m_db.BeginTrans();
m_pSet->Open(CRecordset::snapshot, sSQL); // dynasets not supported
}
}
catch(CDBException *e){
e->ReportError();
e->Delete();
m_db.Rollback();
}
//////////////////////////////////////////////////////////
Thanx.