日期:2012-06-12  浏览次数:20886 次

 
使用断开的Recordset的一个关键条件就是使用客户端临时表,即     

指定Rs.CursorLocation  =  adUseClient  or  3,下面是一个完整     
   的例子:     
   demo-1.asp  (在线演示:http://www.aspcn.com/demo/demo-1.asp)     
   ------------------------------------------------------------     
<%@  Language=VBScript  %>     
<%     
'#  -------------------------------------------------------------------     
---------     
'#  程序描述:演示使用断开的记录集     
'#  程序设计:亚豪     
'#  -------------------------------------------------------------------     
---------     

On  Error  Resume  Next     
Dim  adoConn,adoRs,SQLCmd,ConnectString     
'#--------------------------------------------------------------------     
---------     
'#  使用SQL  Server的  DSN-less  方式连接数据库     
'#--------------------------------------------------------------------     
---------     
ConnectString  =  "Driver={SQL  Server};"  &  _     
                       "Server=(local);"  &  _     
                       "Database=abc;"  &  _     
                       "Uid=sa;"  &  _     
                       "Pwd=123"     

'#--------------------------------------------------------------------     
---------     
'#  创建对象实例,并初始化连接(Connection)     
'#--------------------------------------------------------------------     
---------     
Set  adoConn  =  Server.CreateObject("ADODB.Connection")     
Set  adoRs  =  Server.CreateObject("ADODB.Recordset")     
adoConn.Open  ConnectString     

SQLCmd  =  "Select  *  from  bbs_user  where  LTrim(RTrim(id))  =  'w3org'"     
'#--------------------------------------------------------------------     
---------     
'#  使用客户端临时表打开并保存记录集,关键所在!     
'#  客户端是运行ASP程序的主机,相对于数据库服务器而言     
'#--------------------------------------------------------------------     
--------