rs("xs_id")=Session("xsid")
rs("kc_id")=kc_id
rs("cs")=1
rs.update
rs.close
set rs=nothing
else
sql="select cs from cs_table"
set rscat=server.createobject("adodb.recordset")
rscat.open sql,conn,1,1
if Clng(rscat("cs")) <= Clng(rs("cs")) then
founderr=true
errmsg=errmsg+"<br>"+"<li>你已经超出该老师评议次数!"
rscat.close
set rscat=nothing
else
rs("cs")=rs("cs")+1
rs.update
rscat.close
set rscat=nothing
rs.close
set rs=nothing
end if
end if
if founderr then
call diserror()
response.End
end if
系统进行身份验证、权限识别和结果查看的核心代码如下:
<%sub yddpf()
Set rs = Server.CreateObject("ADODB.Recordset")
sql="SELECT * FROM score where t_id="&Session("t_py")
rs.OPEN sql,Conn,1,1
if rs.eof and rs.bof then
errmsg=errmsg+"<br>"+"<li>没有评测!"
FoundErr=True
call diserror()
response.end
else
Set rs2 = Server.CreateObject("ADODB.Recordset")
sql="SELECT t_name FROM t_table where t_id="&Session("t_py")
rs2.OPEN sql,Conn,1,1
%>
<%rs2.close
set rs2=nothing
rs.close
set rs=nothing
end if
end sub
图4-9评分统计界面
实现以上功能的核心代码如下:
<%sub save()
if CommentedID<>"" then
if instr(CommentedID,"|")>0 then
arrCommentedID=split(CommentedID,"|")
for i=0 to ubound(arrCommentedID)
if CStr(arrCommentedID(i))=kc_name then
Commented=True
exit for
end if
next
else
if CStr(CommentedID)=kc_name then
Commented=True
end if
end if
end if
if Commented=True then
FoundErr=True
errmsg=errmsg &+"<br>"+ "<li>你已经对该课程发表过评议了!</li>"
end if
if founderr then
call diserror()
response.End
end if