+ -
当前位置:首页 → 问答吧 → 错误:对象关闭时,不允许操作,这个该怎么解决

错误:对象关闭时,不允许操作,这个该怎么解决

时间:2011-12-09

来源:互联网

sql语句在sqlserver企业管理其中验证过没有错误的,但是在浏览器中调试的时候就会提示“对象关闭时不允许操作”,百度上查看了一大堆网页,都没有找打哦可以解决的方法,自己问问大家,下面是代码。
HTML code

<%@ Language=VBScript codepage="65001"%>
<!doctype html system>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
</head>
<body <%Session.CodePage = 65001%>>
<%
if Request.ServerVariables("REQUEST_METHOD")="POST" then
dim k,str,ary,sql
 set conn=server.createobject("adodb.connection")
    conn.open"Provider=SQLOLEDB;server=stu19;database=lan;uid=sa;pwd="    
        set rs=server.createobject("adodb.recordset")
        str=request.form("a")
    ary=split(str,",")
for k=0 to ubound(ary,1)
        sql="update 订单表 set sent='是' where Order_ID='" & ary(k) & "'"    
        rs.open sql,conn,1,3
        rs.update        
    next
    response.redirect("order.asp")
end if 
%>
</body></html>

作者: Lanal11   发布时间: 2011-12-09

HTML code

<%@ Language=VBScript codepage="65001"%>
<!doctype html system>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
</head>
<body <%Session.CodePage = 65001%>>
<%
if Request.ServerVariables("REQUEST_METHOD")="POST" then
dim k,str,ary,sql
 set conn=server.createobject("adodb.connection")
    conn.open"Provider=SQLOLEDB;server=stu19;database=lan;uid=sa;pwd="    
               str=request.form("a")
    ary=split(str,",")
for k=0 to ubound(ary,1)
        sql="update 订单表 set sent='是' where Order_ID='" & ary(k) & "'"    
        conn.execute(sql)      
    next
    response.redirect("order.asp")
end if 
%>
</body></html>


作者: tcwsyt   发布时间: 2011-12-09

ConnStr="driver={SQL Server};server="&SqlLocalName&";uid="&SqlUsername&";pwd="&SqlPassword&";database="&SqlDatabaseName&";"

on error resume next
Set conn = Server.CreateObject("ADODB.Connection")
conn.commandtimeout=20
conn.open ConnStr

作者: hefeng_aspnet   发布时间: 2011-12-09