大家好,我使用的是ado连接sybase 11数据库,在执行open函数的时候,捕捉到了抛出了第一个异常
错误信息是:error: IDispatch error #3092下面是我的代码,请大家指教,谢谢。 _RecordsetPtr m_pRecordset = NULL;
try
{
m_pRecordset.CreateInstance(__uuidof(Recordset));
m_pRecordset->CursorType = adOpenStatic;
m_pRecordset->CursorLocation = adUseClient;
m_pRecordset->Open(sql,
m_pConnection.GetInterfacePtr(),
adOpenKeyset,
adLockOptimistic,
adCmdText); DbSybaseRes* pRS = new DbSybaseRes(m_pRecordset);
if(NULL !=pRS)
return pRS;
}
catch(_com_error& e)
{
WriteLog("SQL %s error: %s\n", sql, e.ErrorMessage());
return NULL;
}
catch(...)
{
WriteLog("执行打开记录集的SQL语句 %s 出现未知的异常错误。 \n", sql);
return NULL;
} return NULL;
错误信息是:error: IDispatch error #3092下面是我的代码,请大家指教,谢谢。 _RecordsetPtr m_pRecordset = NULL;
try
{
m_pRecordset.CreateInstance(__uuidof(Recordset));
m_pRecordset->CursorType = adOpenStatic;
m_pRecordset->CursorLocation = adUseClient;
m_pRecordset->Open(sql,
m_pConnection.GetInterfacePtr(),
adOpenKeyset,
adLockOptimistic,
adCmdText); DbSybaseRes* pRS = new DbSybaseRes(m_pRecordset);
if(NULL !=pRS)
return pRS;
}
catch(_com_error& e)
{
WriteLog("SQL %s error: %s\n", sql, e.ErrorMessage());
return NULL;
}
catch(...)
{
WriteLog("执行打开记录集的SQL语句 %s 出现未知的异常错误。 \n", sql);
return NULL;
} return NULL;
用VC和ADO对数据库操作产生异常的处理,欢迎高手大总结
http://community.csdn.net/Expert/topic/4310/4310776.xml?temp=.4206049
这个错误的意思好像是 SQL语句中的表名称有问题。
参考这个例子,看看你的sql变量是否有相似的错误