当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 我的电脑自从重装winxp系统后,屏幕一直不太清晰,主要是中央部位有一块约20cm直径的区域。将视频信号电频由0.7v调至1.0v后,就会好一些,但中部仍不够清晰。xp应该不需要装显卡的驱动吧,那为什么会这样呢?而且有时屏幕画面会突然跳一下,然后很清晰,但持续时间极短。请各位指点,我眼睛都快不行了. ......
 ·备战面试 , 呀 pfc 高手快来     »显示摘要«
    摘要: 1、 pfc 的数据窗口的"主从表服务"在哪 ?《powerbuild 基础类库技术详解》 这本书上没说 ? 2、如果程序是基于 pfc 的, 那是不是所有的控件都要用那些用户对象 ?是不是说我就再也不能用普通的 "button" 了 ,而要用 u_cb ? ......


如何操作recordset,实现它的断开

就是得到一个Disconnected   RecordSet.  
   
  最好把各种方法都介绍一下

NO.1   作者: kinglyq

dim   rsTmp   as   new   recordset  
  rstmp.curorlocation=aduseclient

NO.2   作者: wolong_cai

dim   rsTmp   as   new   recordset  
  rstmp.curorlocation=aduseclient  
  rstmp.open   ...  
  set   rstmp.activeconnection   =   nothing

NO.3   作者: masterz

http://www.codeguru.com/mfc_database/disconnectedado.shtml  
  Creating   a   Disconnected   Recordset   in   C++   For   VB    
   
  --------------------------------------------------------------------------------  
  This   article   was   contributed   by   Jeff   Lundgren.    
  Environment:   Visual   C++   6.0   and   VB   6.0,   ADO   1.5    
   
  This   article   assumes   that   you   are   familiar   with   ADO,   Visual   C++   and   ATL.  
   
  This   article   shows   how   to   create   a   Visual   C++   COM   object   that   creates   a   disconnected   ADO   Recordset.   With   a   disconnected   ADO   recordset,   your   ATL   COM   object   can   connect   to   the   database,   create   the   Recordset,   and   disconnect   without   having   to   keep   a   connection   open,   while   allowing   the   client   to   read   the   data   in   the   Recordset.   This   works   great   with   MTS   where   database   connection   pooling   requires   this   functionality.  
   
  Resources:   HOWTO:   Getting   ADO   Disconnected   Recordsets   in   VBA/C++/Java    
  SAMPLE:   ATL2ADO.exe   Returns   Disconnected   ADO   Recordset  
   
  In   your   project   make   sure   you   import   dll   to   create   your   ADO   classes.  
   
   
   
  #import   "c:\program   files\common   files\system\ado\msado15.dll"   no_namespace   rename("EOF",   "adoEOF")   implementation_only  
   
   
  Next   create   a   method   with   an   [out,   retval]   property   of   type   _Recordset   **  
   
   
  [id(1),   helpstring("method   GetADORecordset")]   HRESULT   GetADORecordset(   [out,   retval]   _Recordset   **ppRecordset);  
   
   
  Your   source   code   should   look   something   like   this:  
   
   
  STDMETHODIMP   CReturnADO::GetADORecordset(_Recordset   **ppRecordset)  
  {  
   
  _ConnectionPtr pConnection;  
  _RecordsetPtr pRecordset;  
   
  try  
  {  
  pConnection.CreateInstance(__uuidof(Connection));  
  pConnection->CursorLocation   =   adUseClient;   //   Important   for   disconnected   sets  
  pConnection->Open("DSN=SQLSource","loginnmae","password",-1);  
   
   
  pRecordset.CreateInstance(__uuidof(Recordset));  
  pRecordset->CursorLocation   =   adUseClient;   //   Important   for   disconnected   sets  
   
  pRecordset->PutRefActiveConnection(pConnection.GetInterfacePtr());   //   Associate   the   connection   to   this   recordset  
   
  pRecordset->Open("SELECT   DISTINCT   name   FROM   TBLWHATEVER   WHERE   name   IS   NOT   NULL",vtMissing,  
  adOpenForwardOnly,   adLockReadOnly,  
  adCmdText);  
   
                  pRecordset->PutRefActiveConnection(NULL);   //   Disassociate   the   connection   from   the   recordset.  
   
  if(pConnection->GetState()   ==   adStateOpen)  
  pConnection->Close();  
  pConnection   =   NULL;  
   
  *ppRecordset   =   pRecordset.Detach();  
   
  }  
  catch(_com_error   *e)  
  {  
  return   AtlReportError(CLSID_ReturnADO,e->ErrorMessage(),IID_IReturnADO,E_FAIL);  
  }  
  catch(...)  
  {  
  return   AtlReportError(CLSID_ReturnADO,"Unknown   Error.",IID_IReturnADO,E_FAIL);  
  }  
   
  return   S_OK;  
  }  
   
   
  Now   your   interface   descriptions   and   CLSIDs   will   be   different,   but   go   ahead   and   use   this   code   to   build   your   own   version.   Your   VB   code   might   look   something   like   this:  
   
   
          Dim   adoset   As   ADODB.Recordset  
          Dim   engine   As   New   TESTRETURNADOLib.ReturnADO  
           
          Set   adoset   =   engine.GetADORecordset  
          While   Not   adoset.EOF  
                  List1.AddItem   adoset.Fields(0)  
                  adoset.MoveNext  
          Wend  
           
          Set   adoset   =   Nothing  
   
   
   
  Date   Posted:   May   20,   1999    
   
 


    摘要: asp通过odbc与sql server连接时,是建立"用户dsn"还是"系统dsn",它们有什么区别吗?分别用在什么情况? ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE