加勒比海盗5百度云盘:谁能帮我解决一个关于ASP代码的问题?重谢

来源:百度文库 编辑:神马品牌网 时间:2024/05/11 15:32:22
我用ASP做了一个在线考试系统,这是用户登陆后出现的问题,提示set rs=conn.execute(str)错误,请问这是怎么回事?请详细些!————

<!--#include file="open.asp" -->
<!--#include file="inc/md5.inc" -->
<%path_name=request.servervariables("SCRIPT_NAME")
strnum=len(path_name)-instrrev(path_name,"/")
self_name=right(path_name,strnum)%>
<%
doing=request.querystring("doing")
if doing="login" then '用户登录
user_id=trim(request.form("user_id"))
pass=trim(request.form("pass"))
if user_id<>"" and pass<>"" and instr(user_id,"'")=0 and instr(user_id,"&")=0 then
pass=ucase(md5(pass))
str="select * from user_teacher where teacher_user='"&user_id&"' and teacher_pass='"&pass&"'"
set rs=conn.execute(str)
if not rs.eof then
session("zzteacher")=true
session("name")=rs("teacher_name")
if rs("teacher_class")="超级管理员" then session("zzadmin")=true end if
else
str="select * from user_student where 学籍号='"&user_id&"' and 密码='"&pass&"'"
set rs=conn.execute(str)
if not rs.eof then
session("zzstudent")=true
session("student_id")=user_id
session("name")=rs("姓名")
session("student_bj")=rs("班级")
end if
end if
end if
end if
%>
我改了,还是不行,提示说:没有为命令对象设置命令?????????????????????

查询语句(select)会返回数据集,一定要用open命令即把set rs=conn.execute(str) 替换成rs.open str,conn,1,1

str重名没关系

你有三个set rs=conn.execute(str),把str改名,如str1,str2,不要有重复的