| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1906 人关注过本帖
标题:ADODB.Recordset 错误 '800a0e7d' 连接无法用于执行此操作。在此上下文中它 ...
只看楼主 加入收藏
alanslow
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-10-22
收藏
 问题点数:0 回复次数:0 
ADODB.Recordset 错误 '800a0e7d' 连接无法用于执行此操作。在此上下文中它可能已被关闭或无效。
ADODB.Recordset 错误 '800a0e7d'

连接无法用于执行此操作。在此上下文中它可能已被关闭或无效。

/Conn.asp,行 71

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%

'--------------------------------------------------
'--------------------------------------------------
Session.CodePage=65001
Response.codepage=65001
Response.Charset="UTF-8"
'on Error Resume Next
Response.Buffer = True
Response.expiresabsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","no-store"

'Response.Clear
'Server.ScriptTimeOut= 999999
'Session.Timeout = 30
'Dim isdata
isdata = 1

Function OpenConn()
    dim conn
    dim connstr
    dim db,pass_word,User_ID,Data_Source
    Data_Source="127.0.0.1"     '请输入Sqlserver服务器的IP地址,或者数据库实例名称
    DbPort="1433"           '数据库连接端口号,默认为1433,一般此处不需要更改
    db="26"                  '请输入Sqlserver服务器的数据库名称
    User_ID="sa"            '请输入连接Sqlserver服务器的用户名
    pass_word="sa"      '请输入连接Sqlserver服务器的密码
   
    On Error Resume Next
    If DbPort="1433" Then
     DbPort=""
    Else
     DbPort=","&DbPort
    End If
   
    Set conn = Server.CreateObject("ADODB.Connection")
    connstr="Provider=SQLOLEDB.1;Password='"&pass_word&"';"&"Persist Security Info=True;User ID='"&User_ID&"';"&"Initial Catalog='"&db&"';"&"Data Source='"&Data_Source&DbPort&"';Connect Timeout=15"
    conn.Open connstr
    Set OpenConn = conn
End Function

if isdata = 1 then
   set conn = OpenConn()
else
    ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(Mdb)
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Open connstr
    If Err Then
        err.Clear
        Set Conn = Nothing
        Response.Write "数据库连接出错,请检查数据库连接文件中的数据库参数设置。"
        Response.End
    End If
end if

Sub CloseConn(Conn) '关闭数据库代码
    On Error Resume Next
    If IsObject(Conn) then
        Conn.Close()
        Set Conn = Nothing
    End If
    If Err Then Err.Clear
End Sub

Set RsSet=Server.CreateObject("Adodb.RecordSet")
Sql="Select Top 1 * From Admin Order By ID"
RsSet.Open Sql,Conn,1,1//出错行

If RsSet.Eof Then
 Response.Write "数据库错误"
 Response.end
End If

'网站名称
WebTitle = GetSet(RsSet("SiteName"),"WebName")
'网站子标题
WebsTitle = GetSet(RsSet("SiteName"),"WebsName")
'网站域名
WebUrl = RsSet("SiteUrl")
'网站金币名称
Webjb = RsSet("Webjb")
'网站成长值名称
Webgrow = RsSet("Webgrow")
'系统安全码
SysCode = RsSet("SysKey")
'备案号
beianCode = GetSet(RsSet("SiteFooter"),"footbeian")
'备案号
tongjiCode = GetSet(RsSet("SiteFooter"),"foottongji")
'使用的模板名称
TemplateName=RsSet("TemplateName")
zxwplzb = RsSet("weblzb")
'--------------------------------
'开关
web_on = RsSet("web_on")
JifenOn = RsSet("jifentomoney")
adpagesize = RsSet("syspagesize")
UserManagePath = RsSet("UserManagePath")
'if web_on = 0 then
'response.Redirect("")
'end if
%>
搜索更多相关主题的帖子: 上下文 
2014-10-22 13:23
快速回复:ADODB.Recordset 错误 '800a0e7d' 连接无法用于执行此操作。在此上下 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017124 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved