我写了一个将mysql数据库的内容导入Acces数据库的程序.
连接mysql成功且能读出记录的内容。但在向Access发送sql命令时出项异常,以下为其代码
CString ComTexttmp;
_bstr_t ComText;
ComTexttmp.Format("%s","INSERT INTO table()VALUES());
ComText=ComTexttmp.AllocSysString();
m_pRecordset=m_pConnection->Execute(ComText,NULL,adCmdText);
在执行m_pRecordset=m_pConnection->Execute(ComText,NULL,adCmdText)语句时,发生异常
还有在调试完后,调试窗口会出现以下类似的信息
Loaded 'C:\WINDOWS\SYSTEM\OLEAUT32.DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM\OLE32.DLL', no matching symbolic information found.
诚心求教各位大虾帮助

解决方案 »

  1.   

    你写的那个SQL语句,是简写了,还是你程序当中本身就是这样写的啊??
      

  2.   

    BSTR bstr = str.AllocSysString();// Normally, if you pass the BSTR, you will
    // need to free the string after returning from the function call.
    你加 SysAllocString 函数释放
      

  3.   

    CString ComTexttmp;

    ComTexttmp.Format("%s","INSERT INTO table(???)VALUES(???));
    _bstr_t ComText(ComTexttmp);
    m_pRecordset=m_pConnection->Execute(ComText,NULL,adCmdText);
    看看
      

  4.   

    void CQuery::UpdateDB(CString m_strSQL)
    {
    _CommandPtr pCommand;
    _RecordsetPtr MySet;
    pCommand.CreateInstance(__uuidof(Command));
    pCommand->ActiveConnection=m_pConnection; 
    /////////////////////////////////////////////////////////
    pCommand->CommandText=(_bstr_t)m_strSQL;
    pCommand->CommandType=adCmdText;

    try
    {
    pCommand->Parameters->Refresh();
    pCommand->Execute(NULL,NULL,adCmdUnknown);
    }
    catch(_com_error e)
    {
    CString errormessage;
    errormessage.Format("错误信息:%s",e.ErrorMessage());
    AfxMessageBox(errormessage);

    }