先使用Open(CRecordset::snapshot)试试。

解决方案 »

  1.   

    在isapi中用ado访问数据库
    1.ISAPI------need to add some lines to stdafx.h:
    #include <atlbase.h>
    #import "H:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace rename("EOF", "EndOfFile")void CISAMExtension::Default(CHttpServerContext* pCtxt)
    {
     //GetListFrame(pCtxt);
     char mybuf[10240];
       CoInitialize(NULL);
       try 
       {
          _ConnectionPtr pConn("ADODB.Connection");
          _RecordsetPtr  pRst("ADODB.Recordset");
     
          pConn->Open("Provider=sqloledb;Data Source=Server1;"
             "Initial Catalog=test1;User Id=sa;Password=sa;", 
             "", "", adConnectUnspecified);
    // Note 1.
          pRst->Open(
             "userinfo",
             _variant_t((IDispatch *) pConn, true),
             adOpenStatic,
             adLockReadOnly,
             adCmdTable);
          pRst->MoveLast();
    // Note 2.
          sprintf(mybuf,"Last name is '%s %s'\n", 
                (char*) ((_bstr_t) pRst->GetFields()->GetItem("username")->GetValue()),
                (char*) ((_bstr_t) pRst->Fields->Item["otherinfo"]->Value));
     
          pRst->Close();
          pConn->Close();
       }
       catch (_com_error &e)
       {
          sprintf(mybuf,"Description = '%s'\n", (char*) e.Description());
       }   
    ::CoUninitialize();
    *pCtxt<<mybuf;
     
    }
      

  2.   

    看看这里
    http://codeguru.earthweb.com/isapi/index.shtml
      

  3.   

    看看这里
    http://codeguru.earthweb.com/isapi/index.shtml
      

  4.   

    用俺那个类不行吗?
    m$那套也是封装的odbc api啊。反正俺用得蛮好的。