CString  strQuery="delete from  UserList where UserName='hhh'";   
try
{
HRESULT hr=m_pConnetion->Execute(_bstr_t(strQuery),NULL,adOptionUnspecified);
}
catch(_com_error ex)
{
  AfxMessageBox(ex.Description());
      return FALSE;
}怎么使用上面代码,出现异常:找不到存储过程 ‘hhh’

解决方案 »

  1.   

    改成m_pConnetion->Execute(_bstr_t(strQuery),NULL,adCmdText)依旧不可以呀
      

  2.   

    改成 adCmdStoredProc 呢?
      

  3.   

    语句都没问题的,我试了,没问题;
    _ConnectionPtr pConn(__uuidof(Connection));
    _RecordsetPtr pRst(__uuidof(Recordset));
    pConn->ConnectionString="Driver={MySQL ODBC 5.1 driver};data source=trm_base";
    try
    {
    HRESULT hr = pConn->Open("","","",adConnectUnspecified);
    CString strQuery ="delete from  book_user where 预订人='hhh'"; 
                    hr=pConn->Execute(_bstr_t(strQuery),NULL,adOptionUnspecified);
           }
    catch (_com_error& err)
    {
    }
      

  4.   

    还是找不到存储过程 ‘hhh’
      

  5.   

    o,我用的ODBC,在数据源那里设置的用户名,密码什么的
    LZ,你跟一下了,看连接是否成功,是否初始化Ole,一直跟下去。~
      

  6.   

    都可以了,因为我程序可以进行更新数据,就是删除不行,我换用_connectionptr和_commandptr的也是如此出现爱你错误??