Besides the notes from my comments (specify cursor and lock modes, use
Update()
rather than
UpdateBatch()
), you may also use a SQL command to delete a specific recordset:
ADODB::_CommandPtr pCmd = NULL;
HRESULT hr = pCmd.CreateInstance(__uuidof( ADODB::Command));
if (FAILED(hr))
{
throw _com_error(hr);
}
_bstr_t bstrCmd = "DELETE FROM Table1 WHERE EmpId=1;";
pCmd->CommandText = bstrCmd;
pCmd->ActiveConnection = pConnnect;
pCmd->Execute(NULL, NULL, ADODB::adCmdText);
When using Windows 7 SP1, see also the article
Your ADO is broken[
^] and this comment [
^].