--> adCreateStructDoc = -2147483648,
    adCreateNonCollection = 0,
    adOpenIfExists = 33554432,
    adCreateOverwrite = 67108864,
    adFailIfNotExists = -1
};c:\documents and settings\administrator\my documents\measure\debug\msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned运行不能通过
错误:
“0x0040d468”指令引用的"0xcdcdcdcd"内存。该内存不能为“read”.
请教问题出在什么地方.

解决方案 »

  1.   

    是 Getdocument()返回指针问题吗?
    请教解决方法。。急
      

  2.   

    adCreateStructDoc = -2147483648这个指针有问题,前面可能出问题了
      

  3.   

    引入ADO是有这样的错误,看看MSDN
      

  4.   

    HRESULT hr;
    _ConnectionPtr m_pConnection = NULL;  //here!
    try{
    hr=m_pConnection.CreateInstance("ADODB.Connection");//创建Connection对象
    if(SUCCEEDED(hr))
    {//here!!  _bstr_t("SmsSendBuff")
        hr=m_pConnection->Open(/*cConnectStr,cUID,cPWD,*/_bstr_t("SmsSendBuff"),"sa",
           "",0/*adModeUnknown*/);//连接数据库
    }
     _variant_t rec_affected;
    m_pConnection->Execute(_bstr_t("select * from smssendbuff "),&rec_affected,0);
    }
    catch(_com_error e)
    {
      char cMsg[50];
      sprintf(cMsg,"连接数据库失败!\r\n错误信息:%s",e.ErrorMessage());
      AfxMessageBox(cMsg);
      return;
    }
      

  5.   

    我是用这种方法连接数据库的:BOOL CDbAdoDoc::OnNewDocument()
    {
    if (!CDocument::OnNewDocument())
    return FALSE; // TODO: add reinitialization code here
    // (SDI documents will reuse this document)
    m_strConnection = _T("Provider=MSDASQL.1;Data Source=ERC");
    m_strCmdText = _T("select * from measure"); //Initialize the Recordset and binding pointers
    m_pRs = NULL;
    m_piAdoRecordBinding = NULL;
    //Initialize the COM environment
    ::CoInitialize(NULL);
    try
    {
    //Create the record set object
    m_pRs.CreateInstance(__uuidof(Recordset)); //Open the record set object
    m_pRs ->Open((LPCTSTR)m_strCmdText,(LPCTSTR)m_strConnection,
    adOpenDynamic,adLockOptimistic,adCmdUnknown); //Get a pointer to the record binding interface
    if (FAILED(m_pRs ->QueryInterface(__uuidof(IADORecordBinding),(LPVOID *)&m_piAdoRecordBinding)))
    _com_issue_error(E_NOINTERFACE);
    //Bind the record calss to the record set
    m_piAdoRecordBinding ->BindToRecordset(&m_rsRecSet); //Get a pointer to the view
    POSITION pos = GetFirstViewPosition();
    CDbAdoView* pView = (CDbAdoView*)GetNextView(pos);
    if (pView)
    //Sync the data set with the form
    pView ->RefreshBoundData(); }
    // Any errors?
    catch (_com_error &e)
    {
    // Display the error
    GenerateError(e.Error(),e.Description());
    } return TRUE;
    }
      

  6.   

    "0xcdcdcdcd" 为 m_piAdoRecordBinding 指针 为 IADORecordBinding* 类型 但它应该没错啊?!!
         -_-0