标题:[求助]如何解决ADODB.Recordset (0x800A0E78)对象关闭时,不允许操作。
取消只看楼主
gl0424
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-6-15
 问题点数:0 回复次数:0 
[求助]如何解决ADODB.Recordset (0x800A0E78)对象关闭时,不允许操作。

这是个选课的程序,为什么提示:(奇怪的是虽然提示出错,可是依然可以选课成功.)希望大家帮我看下,帮我改正下错误,谢谢!!!!! 明天就要毕业答辩了...哭啊~~~在线等~~~

错误类型:
ADODB.Recordset (0x800A0E78)
对象关闭时,不允许操作。
/SelectCourse/detectSelectCollision.asp, 第 26 行
--------------------------------------------------------
detectSelectCollision.asp代码如下:
--------------------------------------------------------
<!--#include file="../include/ADOVBS.asp"-->
<!--#include file="../include/keepHouse.asp"-->
<!--#include file="../include/header.asp"-->
<link href="../include/WebCourseSettlementStyle.Css" rel="stylesheet" type="text/css">
<%
dim ARRANGE_ID
ARRANGE_ID=request("ARRANGE_ID")
STUDENT_ID=Session("USER_NAME")
if ARRANGE_ID="" or Session("USER_TYPE")<>"Student" then
trigErr
end if

set Comd=server.createobject("ADODB.Command")
openDB
set Comd.ActiveConnection=conn
Comd.CommandType=adCMdStoredProc
Comd.CommandText="DetectSelectionCollision"
set Para1=Comd.CreateParameter("ARRANGE_ID",adInteger,adParamInput,4)
set Para2=Comd.CreateParameter("STUDENT_ID",adVarChar,adParamInput,20)
Comd.Parameters.Append Para1
Comd.Parameters.Append Para2

Comd("ARRANGE_ID") = ARRANGE_ID
Comd("STUDENT_ID") = STUDENT_ID
set rs1=Comd.execute
if not rs1.eof then //(26行在此!!)
response.write "<table width=70% border=1 cellspacing=0 align='center' "
response.write "cellpadding=0 bgcolor=#E2ECD1 "
response.write "bordercolordark=#FFFFFF bordercolorlight=#66ccff> "
response.write "<tr align='center'><td> "
response.write "<font size='+1' face='黑体' color='red'>该操作引起冲突:</font>"
response.write "</td></tr></table>"
'sql="select * from VIEW_Arrange where ARRANGE_ID="&ARRANGE_ID
'rs.open sql,conn,1,1
%>
<table width="70%" border="1" align="center" cellpadding="0" cellspacing="0"
bordercolorlight="#66ccff" bordercolordark="#FFFFFF" bgcolor="#F0F0F0">
<tr bgcolor=#99CCFF>
<td width="30%" bgcolor=#E2ECD1><strong>课程号</strong></td>
<td width="30%" bgcolor=#E2ECD1><strong>课程名</strong></td>
<td width="30%" bgcolor=#E2ECD1><strong>教师名</strong></td>
</tr>
<tr>
<td><font color=red><%=rs1("COURSE_ID")%></font></td>
<td><font color=red><%=rs1("COURSE_NAME")%></font></td>
<td><font color=red><%=rs1("TEACHER_NAME")%></font></td>
</tr>
</table>
<%
closeDB
response.Write "<A href='#' onclick=history.go(-1)><center>返回</center></a>"
%>
<!--#include file="../include/footer.asp"-->
<%
else
showmsg("选课成功!")
end if
%>
-------------------------------------------------------------------------------------------------------------------------------------------------
忘了说明一下,我用了一个名为DetectSelectionCollision的存储过程,目的是检测选课冲突.把存储过程的代码也贴上来:
create PROCEDURE DetectSelectionCollision
@ARRANGE_ID int,
@STUDENT_ID varchar(20)
AS
declare @DAY_TIME varchar(20)
declare @ARRANGE_ID_LOCAL int
--课程冲突:
select @ARRANGE_ID_LOCAL=ARRANGE_ID from CourseSelect
where ARRANGE_ID=@ARRANGE_ID and STUDENT_ID=@STUDENT_ID

--时间冲突:
select @DAY_TIME=DAY_TIME from Arrange
where ARRANGE_ID=@ARRANGE_ID
--select * from CourseSelect
--here DAY_TIME=@DAY_TIME
SELECT @ARRANGE_ID_LOCAL=CourseSelect.ARRANGE_ID
FROM Arrange INNER JOIN
CourseSelect ON
Arrange.ARRANGE_ID = CourseSelect.ARRANGE_ID
WHERE (Arrange.DAY_TIME = @DAY_TIME)
if @ARRANGE_ID_LOCAL<>''
select ARRANGE_ID,COURSE_ID,COURSE_NAME,TEACHER_NAME from VIEW_Arrange
where ARRANGE_ID=@ARRANGE_ID
else
begin
insert into CourseSelect values(@ARRANGE_ID,@STUDENT_ID)
select ARRANGE_ID from Arrange where ARRANGE_ID=0
end
GO

搜索更多相关主题的帖子: Recordset ADODB 对象 
2006-06-15 12:13



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-72475-1-1.html




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

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