最新下载
热门教程
- 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
'#--------------------------------------------------------------------
相关文章
- picacg官网-最新入口2026 03-14
- PP视频是什么-PP视频如何关闭自动续费 03-14
- 126邮箱官方登录主站直达入口-126邮箱多端同步验证快捷入口 03-14
- 古文翻译神器推荐-文言文转换工具精选 03-14
- 18C.MIC天堂传送门极速直达-18C.MIC天堂官网一键入口 03-14
- mw777蛙漫漫画入口-mw777蛙漫网页版免费漫画畅读入口 03-14