注册 登录
编程论坛 ASP技术论坛

提示错误说对象已关闭,不能实现连续操作,该怎么改啊,各位帮帮我。

Kettyjin1983 发布于 2007-12-06 16:30, 954 次点击
<%@ LANGUAGE="vbscript" %>
<!--#include virtual ="/Include/Conn.asp"-->
<!--#include virtual ="/Include/Frequent.asp"-->

<html>
<head>
<meta http-equiv="Content-Type" c>
<meta name="GENERATOR" c>
<meta name="ProgId" c>
<title>THANKS FOR YOUR SUPPORT</title>
</head>
<body bgcolor="#FFFFFF">
<p>   </p>
  <%
owner=session("owner")
if owner = "" then
  response.redirect "index.htm"
else
  set conn=server.createobject("adodb.connection")
  set rs=server.createobject("adodb.recordset")
  c
  conn.open = constr
  rs.open "SELECT * from mtrack2 where owner = '"&owner&"'and barstatus='wait' and tobe = ''", conn,1,1
  Set temprs = Server.CreateObject("ADODB.Recordset")
  do while not rs.eof
   autoid = rs("autoid")
   tobe = "select"&autoid
   Set temprs = Server.CreateObject("ADODB.Recordset")
   tobe=Trim(Request.Form(tobe))
   response.write tobe
   temprs.open "update mtrack2 set tobe= '"&tobe&"'where autoid='"&autoid&"'",conn,1,3
   
    MailBody="EXEC xp_sendmail "
   
     MailBody=MailBody&"@recipients = '"&tobe&"',"
   
    MailBody=MailBody & "@copy_recipients='" & owner &"',"
   
    MailBody=MailBody & "@subject='Barcode transfer to you from " & owner & "',"
    MailBody=MailBody & "@message='All," & Chr(13)
    MailBody=MailBody & "Please be informed that there is some barcode transfered to you,please visit [url=http://hzmot/quick/m-track/transfer.asp]http://hzmot/quick/m-track/transfer.asp[/url] to take some action."& Chr(13)&Chr(13)
    MailBody=MailBody & "Thanks for your support.'" & Chr(13) & Chr(13)
     call SendMyMail(MailBody)
   temprs.close
   set temprs = nothing
  
  rs.movenext
  
 loop
 
 rs.close
 set rs = nothing
 conn.Close
 set conn = nothing
end if
'response.redirect "transfer.asp"
%>
 
</body>
</html>
3 回复
#2
Kettyjin19832007-12-06 16:32
temprs.open "update mtrack2 set tobe= '"&tobe&"'where autoid='"&autoid&"'",conn,1,3
提示说在第36行,也就是temprs,这里,
[color=black]各位帮我看看啊,自己先顶

[/color]
#3
madpbpl2007-12-06 18:07
Set temprs = Server.CreateObject("ADODB.Recordset")
  do while not rs.eof
   autoid = rs("autoid")
   tobe = "select"&autoid
   Set temprs = Server.CreateObject("ADODB.Recordset")
为什么会有两句
Set temprs = Server.CreateObject("ADODB.Recordset")
还有建议楼主的sql语句中间最好有适当的间隔
如:
temprs.open "update mtrack2 set tobe= '"&tobe&"'where autoid='"&autoid&"'",conn,1,3
写成
temprs.open "update mtrack2 set tobe= '"&tobe&" 'where autoid='"&autoid&"'",conn,1,3
比较好
#4
Kettyjin19832007-12-07 09:13
<%@ LANGUAGE="vbscript" %>
<!--#include virtual ="/Include/Conn.asp"-->
<!--#include virtual ="/Include/Frequent.asp"-->

<html>
<head>
<meta http-equiv="Content-Type" c>
<meta name="GENERATOR" c>
<meta name="ProgId" c>
<title>THANKS FOR YOUR SUPPORT</title>
</head>
<body bgcolor="#FFFFFF">
<p>   </p>
  <%
owner=session("owner")
if owner = "" then
  response.redirect "index.htm"
else
  set conn=server.createobject("adodb.connection")
  set rs=server.createobject("adodb.recordset")
  c
  conn.open = constr
  rs.open "SELECT * from mtrack2 where owner = '"&owner&"'and barstatus='wait' and tobe = ''", conn,1,1
  
  do while not rs.eof
   autoid = rs("autoid")
   tobe = "select"&autoid
   Set temprs = Server.CreateObject("ADODB.Recordset")
   tobe=Trim(Request.Form(tobe))
   response.write tobe
   temprs.open "update mtrack2 set tobe= '" &tobe& "'where autoid='" &autoid& "'",conn,1,3
   
    MailBody="EXEC xp_sendmail "
   
     MailBody=MailBody&"@recipients = '" &tobe& "',"
   
    MailBody=MailBody & "@copy_recipients='" & owner &"',"
   
    MailBody=MailBody & "@subject='Barcode transfer to you from " & owner & "',"
    MailBody=MailBody & "@message='All," & Chr(13)
    MailBody=MailBody & "Please be informed that there is some barcode transfered to you,please visit [url=http://hzmot/quick/m-track/transfer.asp]http://hzmot/quick/m-track/transfer.asp[/url] to take some action."& Chr(13)&Chr(13)
    MailBody=MailBody & "Thanks for your support.'" & Chr(13) & Chr(13)
  
    call SendMyMail(MailBody)
   Temprs.close
   set temprs = nothing
  
  rs.movenext
  
 loop
 
 rs.close
 set rs = nothing
 conn.Close
 set conn = nothing
end if
%>
 
</body>
</html>

错误提示:
ADODB.Recordset 错误 '800a0e78' 对象关闭时,不允许操作。 /quick/m-track/dealtransfer.asp,行51

执行时,邮件只能发出去一份,也就是只能执行一次循环,第二次就不行了。不知道怎么回事啊,帮我看下啊
1