下面这个程序有时候运行正常而又有时候会提示如下错误:
rs.update
rs.close
set rs=nothing
end if
[0]Script error detected at line 36,col[0].
Description: [Microsoft][ODBC Microsoft Access Driver]行中有错误
源程序
<!--#include file="conn.asp"-->
<%
dim user_name,user_testnumber,user_class,testno,subject,ach
user_name=trim(request("user_name"))
user_testnumber=trim(request("user_testnumber"))
user_class=trim(request("user_class"))
testno=trim(request("testno"))
subject=trim(request("subject"))
ach=trim(request("ach"))
%>
<%
set rs=createobject("adodb.recordset")
sql="select * from ach where user_testnumber='"&user_testnumber&"' and subject='"&subject&"'"
rs.open sql,conn,1,3
%>
<%
if not rs.eof then
'response.write "准考证号"& user_testnumber &"该课程成绩已经存在,如要修改请到修改页面。"
response.write "准考证号"& user_testnumber &"该课程成绩已经存在,如要修改请到修改页面。"&"<a href='Javascript:window.history.go(-1)'>返回</a>"
response.end
else
rs.addnew
rs("user_name")=user_name
rs("user_testnumber")=user_testnumber
rs("user_class")=user_class
rs("testno")=testno
rs("subject")=subject
rs("ach")=ach
rs.update
rs.close
set rs=nothing
end if
%>
<%
set rs1=server.createobject("adodb.recordset")
sql1="select * from total_ach where user_testnumber='"&user_testnumber&"'"
rs1.open sql1,conn,1,3
if not rs1.eof then
rs1("total_ach")=rs1("total_ach")+ach
rs1.update
rs1.close
set rs1=nothing
response.write "成绩添加成功,请<a href='Javascript:window.history.go(-1)'>返回</a>"
else
rs1.addnew
rs1("user_testnumber")=user_testnumber
rs1("user_name")=user_name
rs1("user_class")=user_class
rs1("testno")=testno
rs1("total_ach")=ach
rs1.update
rs1.close
set rs1=nothing
response.write "成绩添加成功,请<a href='Javascript:window.history.go(-1)'>返回</a>"
end if
%>