标题:求高手帮忙看看代码哪里错了!
只看楼主
人生无幻
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-4-15
 问题点数:0 回复次数:1 
求高手帮忙看看代码哪里错了!
<!--#include file="conn.asp"-->
<%
if session("adminlogin")="" then
Response.Write("<script language=javascript>alert('你尚未登录,或者超时了!请重新登录');this.location.href='login.asp';</script>")
Response.End
End if
subject=request("科目")
singlecount=request("单选数目")
singleper=request("单选分值")
multicount=request("多选数目")
multiper=request("多选分值")
score=0
j=0
     for each element in request.form
     for i=1 to request.form(element).count
    if instr(element,"NO")<>0 then
      id=mid(element,3,1)
      result=request.form(element)(i)
      sql="select * from 题库 where id="& clng(id)
      set rs=server.createobject("adodb.recordset")
      rs.open sql,conn,3,2
      if rs("type")="单选题" then
        if result=rs("正确答案") then
          score=score+cint(singleper)
        end if
      end if
      if rs("type")="多选题" then
        if instr(rs("正确答案"),result)<>0 then
          score=score+cint(multiper)/4
          j=j+1
          answer=split(rs("正确答案"),",")
          answercount=ubound(answer)+1
          if answercount=j then
            score=score+cint(multiper)*(1-j/4)
          end if
        else
          score=score-cint(multiper)/4*(j)
        end if
      end if
         
    end if
  next
next

sql="select * from 成绩表"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
rs.addnew
rs("userid")=userid
rs("学号")=request.cookies("学号")
rs("姓名")=request.cookies("姓名")
rs(" & session("subject") & ")=score
rs.update
rs.close
sql="select * from 考试记录"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
rs("学号")=request.cookies("学号")
rs("姓名")=request.cookies("姓名")
rs(" & session("subject") & ")=1
rs.update
rs.close
%>
搜索更多相关主题的帖子: request element include 
2012-05-20 20:45
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
<!--#include file="conn.asp"-->
<%
if session("adminlogin")="" then
   Response.Write("<script language=javascript>alert('你尚未登录,或者超时了!请重新登录');this.location.href='login.asp';</script>")
   Response.End
End if
subject=request("科目")
singlecount=request("单选数目")
singleper=request("单选分值")
multicount=request("多选数目")
multiper=request("多选分值")
score=0
j=0
     for each element in request.form
         for i=1 to request.form(element).count
            if instr(element,"NO")<>0 then
               id=mid(element,3,1)
               result=request.form(element)(i)
               sql="select * from 题库 where id="& clng(id)
               set rs=server.createobject("adodb.recordset")
               rs.open sql,conn,3,2
              if rs("type")="单选题" then
                 if result=rs("正确答案") then
                    score=score+cint(singleper)
                 end if
             end if
             if rs("type")="多选题" then
                if instr(rs("正确答案"),result)<>0 then
                   score=score+cint(multiper)/4
                   j=j+1
                   answer=split(rs("正确答案"),",")
                   answercount=ubound(answer)+1
                   if answercount=j then
                      score=score+cint(multiper)*(1-j/4)
                   end if
               else
                  score=score-cint(multiper)/4*(j)
              end if
          end if
       end if
    next
 next
 sql="select * from 成绩表"
 set rs=server.createobject("adodb.recordset")
 rs.open sql,conn,3,2
 rs.addnew
 rs("userid")=userid
 rs("学号")=request.cookies("学号")
 rs("姓名")=request.cookies("姓名")
 rs(" & session("subject") & ")=score
 rs.update
 rs.close
 sql="select * from 考试记录"
 set rs=server.createobject("adodb.recordset")
 rs.open sql,conn,3,2
 rs("学号")=request.cookies("学号")
 rs("姓名")=request.cookies("姓名")
 rs(" & session("subject") & ")=1
 rs.update
 rs.close
%>
session("subject")这个是否有值?还有就是报什么错误?
2012-05-24 10:00



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




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

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