读书人

[]连接无法用于执行此操作。在此上下文

发布时间: 2012-02-29 16:44:10 作者: rapoo

[求助]连接无法用于执行此操作。在此上下文中它可能已被关闭或无效。
ADODB.Recordset 错误 '800a0e7d '

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

/login.asp,行 115

代码如下:
<!--#include file= "360conn.asp "-->
<!--#include file= "360inc/md5.asp "-->
<!--#include file= "360inc/inc_Fun.asp "-->
<%
session( "linecolor ")= "#eeeeee "
dim tableName1,fieldsName
tableName1= "user_sj "
fieldsName= "id,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21 "

set bd=server.CreateObject( "sdCrmSql.sqlBd ")
dim outTime
'outTime=bd.getschdata( "admin_setup ", "id=1 ", "s2 ", "id,s2 ")
'set bd=nothing


%>
<style type= "text/css ">
.
.
.
.(省略部分为CSS)
.
.
}
-->
</style>
<link href= "css/style.css " rel= "stylesheet " type= "text/css " />
<% if request( "action ") <> "login " then %>
<p>   </p>
<body>
.
.
.(省略部分为显示界面)
.
.
</body>

<%
else
dim sql,rs
dim username,password
dim founderr,errmsg
username=trim(request( "username "))
password=trim(request( "password "))

'if not codepass then
'FoundErr=True
'errmsg=errmsg & " <br> <li> 验证码错误! </li> "
'end if


if FoundErr <> True then
password=md5(password)

set rs=server.createobject( "adodb.recordset ")
sql= "select * from "& tableName1 & " where s1= ' "&username& " ' "
showmsg sql
if not IsObject(conn) then link_database
rs.open sql,conn,3,1 '(这就是出错的115行)

if rs.bof and rs.eof then
FoundErr=True
errmsg=errmsg & " <br> <li> 用户名或密码错误! </li> "
else
'showmsg password
if password <> trim(rs( "s2 ")) then
FoundErr=True
errmsg=errmsg & " <br> <li> 用户名或密码错误! </li> "
else
'
if makeclng(rs( "lock_flag "))=1 then
FoundErr=True
errmsg=errmsg & " <br> <li> 该用户已锁定,暂时不能使用! </li> "
else

.
.
.
.
.
.

set bd=nothing
%>

[解决办法]
conn 已经被关闭了
[解决办法]
rs.open sql,conn,1,3
试试
不行用这个
set rs = conn.execute(sql)
[解决办法]
可能是其它页执行了conn.close set conn = nothing
[解决办法]
你的connection对象在哪里创建的?

读书人网 >ASP

热点推荐