最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
断开的数据库连接的一个例子
时间:2022-06-30 10:23:21 编辑:袖梨 来源:一聚教程网
使用断开的Recordset的一个关键条件就是使用客户端临时表,即
指定Rs.CursorLocation = adUseClient or 3,下面是一个完整
的例子:
demo-1.asp (在线演示:http://www.**as*pcn.com/demo/demo-1.asp)
------------------------------------------------------------
'# -------------------------------------------------------------------
---------
'# 程序描述:演示使用断开的记录集
'# 程序设计:亚豪
'# -------------------------------------------------------------------
---------
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程序的主机,相对于数据库服务器而言
'#--------------------------------------------------------------------
---------
adoRs.CursorLocation = 3 'Const adUseClient = 3
adoRs.Open SQLCmd,adoConn,0,2
'#--------------------------------------------------------------------
指定Rs.CursorLocation = adUseClient or 3,下面是一个完整
的例子:
demo-1.asp (在线演示:http://www.**as*pcn.com/demo/demo-1.asp)
------------------------------------------------------------
'# -------------------------------------------------------------------
---------
'# 程序描述:演示使用断开的记录集
'# 程序设计:亚豪
'# -------------------------------------------------------------------
---------
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程序的主机,相对于数据库服务器而言
'#--------------------------------------------------------------------
---------
adoRs.CursorLocation = 3 'Const adUseClient = 3
adoRs.Open SQLCmd,adoConn,0,2
'#--------------------------------------------------------------------
相关文章
- 逃离鸭科夫武器耐久修复方法分享 11-06
- 咸鱼之王平民佗角阵容有哪些-平民佗角阵容搭配方案分享 11-06
- 天命重启心跳的抉择第五章全流程攻略 11-06
- 红色的炼金术士黑白眼镜衍生图一览 11-06
- 冲就完事模拟器2家园基地三只猫位置 11-06
- 逃离鸭科夫炸弹狂人打法攻略分享 11-06