一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

网络考场(1)(转)logon.asp

时间:2008-01-18 编辑:简简单单 来源:一聚教程网

<%@ Language=VBScript %>
<%
if Request.ServerVariables("http_method")="POST" then
    if Request.Form("submit")="进入1" then
        '学生进入网络考场的处理
        set conn=server.CreateObject("adodb.connection")
        conn.ConnectionString="dsn=testsys"
        '连接并打开数据库
        conn.open
        strsql="select * from studentinfo where stid='" & Request.Form("stid") & "' and stname='" & Request.Form("stname") & "'"
        set mrs=conn.Execute(strsql)
        if not mrs.bof and    not mrs.eof then
        '如果数据库中存在该学生的记录进入网络考场
        '并用session属性存储学生的姓名与学号
       session("stid")=Request.Form("stid")
       session("stname")=Request.Form("stname")
       Response.Redirect "stselectsub.asp"
       set mrs=nothing
        else
        '如果数据库中不存在该学生的信息,显示的页面仍为logon.asp,并提示信息
       Response.Write "学生姓名与学号输入错误!!"
        end if
        conn.Close

热门栏目