在OLE DB  开发ACcess 中;发现表或命令对象都打不开,Create(“..”“..”)成功之后,但其中的行集对象为NUL。
请问这是怎么回事呢?
拜托了。各位大侠指点一下吧。

解决方案 »

  1.   

    long     mRowCount=7;
    CString   strCommand=L" SELECT StationName , StationNote FROM MonitorStationTable";
    CCommand  < CAccessor<CStationName> >  StationList;   
    if( StationList.Open( m_Session,strCommand,NULL,&mRowCount,DBGUID_DEFAULT,FALSE)!=S_OK)
    {
    AfxMessageBox("打开失败!");
      StationList.Close();
    return  FALSE;
    }if(StationList.Bind()!=S_OK)
    {
        AfxMessageBox("Bind Error");
    }就这样,Bind()不S_OK了。如果在Open()中将最后一个参数设为TRUE,Open()就不会返回S_OK了。
    请问这是怎么回事呢?
      

  2.   

    谁来指点一下。 
    CString     strCommand=L" INSERT INTO  MonitorStationTable VALUES ( '3','aaa',‘bbb') ";CCommand  <CManualAccessor,CNoRowset>  StationList;

    HRESULT  hr=StationList.Open( m_Session,strCommand,NULL,&mRowCount,DBGUID_DEFAULT,FALSE);
    //m_Session已经打开了;
    if(FAILED(hr))

    AfxMessageBox("Fail");
    }
    为什么会错呢?