islheg
April 1st, 2004, 08:56 AM
I developed an database application using VC++ and Micorsoft Access driver as the ODBC source. There are 2 threads in the application both accessing the same table. The first thread writes data in the table and the second thread reads and deletes data from the table. Here is a snapshot of the code of the second thread:
while (!attackRecSet->IsEOF())
{
.
.
.
.
.
.
try
{
attackRecSet->Delete();
attackRecSet->MoveNext();
} //try
catch(CDBException *e)
{
MessageBox(NULL, e->m_strError, "Error", MB_OK);
e->Delete();
} //catch
} //while
An error message occurs because of the delete function and the thread stops working. the error message is:
" Could not update; currently locked by user 'admin' on machine ISLAM_COMPUTER'. "
and when I press OK the following message occurs for ever (it reoccurs if I press the OK button):
" Invalid cursor position; no keyset defined. "
If I commented the delete function the thread will work perfectly. I searched the MSDN for an explanation but with no use. Could anyone tell where could I find an explanation for this error.
Islam Hegazy
while (!attackRecSet->IsEOF())
{
.
.
.
.
.
.
try
{
attackRecSet->Delete();
attackRecSet->MoveNext();
} //try
catch(CDBException *e)
{
MessageBox(NULL, e->m_strError, "Error", MB_OK);
e->Delete();
} //catch
} //while
An error message occurs because of the delete function and the thread stops working. the error message is:
" Could not update; currently locked by user 'admin' on machine ISLAM_COMPUTER'. "
and when I press OK the following message occurs for ever (it reoccurs if I press the OK button):
" Invalid cursor position; no keyset defined. "
If I commented the delete function the thread will work perfectly. I searched the MSDN for an explanation but with no use. Could anyone tell where could I find an explanation for this error.
Islam Hegazy