try{
strSqlSoundFileTable.Format("SELECT * FROM SoundFileTable WHERE SoundFileName='%s'",strSoundFileName);
_RecordsetPtr recordSetPtr=ExcuteSql(strSqlSoundFileTable); if (!(recordSetPtr->BOF))
{
recordSetPtr->MoveFirst();
///此文件名已在声音库中存在了那么提示,让用户选择(覆盖,不覆盖(使用以前的),取消添加
///覆盖,删除
recordSetPtr->Delete(adAffectCurrent);
//recordSetPtr->Update();
}
}catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
}
总是报错,并且 错误无法被捉到,(错误就在recordSetPtr->Delete(adAffectCurrent);这一句上)
其它功能都正常(如添加,查询,更改)
请高手帮助
{
CString sErrors;
if(pConnection != NULL)
{
ADODB::ErrorsPtr ptrErrors = pConnection->Errors;
long lCount = ptrErrors->Count;
ADODB::ErrorPtr ptrError = NULL;
CString sError;
for(long n = 0; n < lCount; n++)
{
ptrError = ptrErrors->GetItem(n);
sError.Format(
_T("%s\nState: %s, Native: %d, Source: %s"),
(LPCTSTR)ptrError->Description,
(LPCTSTR)ptrError->SQLState,
ptrError->NativeError,
(LPCTSTR)ptrError->Source
);
sErrors += sError + TEXT("\n\n");
}
} if(!sErrors.IsEmpty())
sErrors = sErrors.Left(sErrors.GetLength()-2); return sErrors;
}_ConnectionPtr pConnection
catch(const _com_error& e)
{
CString sBuff = GetProviderError(pConnection);
if(sBuff.IsEmpty())
{
sBuff=GetComError(e);
}
AfxMessageBox(sBuff);
}