注册 登录
编程论坛 ASP技术论坛

求助:我刚刚开始学建站,这是人家的一个在线考试系统,我想高手帮我分解下

天堂小孩 发布于 2008-05-09 23:05, 911 次点击
<%@ Language=VBScript %>
<% option explicit %>
<!--#include file="conn.asp"-->
<% if Request.ServerVariables("http_method")="POST" then   
    if Request.Form("submit")="登    录" then
        '学生登录的处理
           dim rs,sql    
        set rs = server.createobject("adodb.recordset")
                sql="select * from student where studentname='" & Request.Form("studentname") & "' and studentpassword='" & Request.Form("studentpassword") & "'"
                    rs.open sql,conn,1,1
               if err.number<>0 then
        response.write "数据库操作失败:"&err.description
               else if rs.bof and rs.eof then
            
                response.write "<center>对不起,请输入正确的用户名和密码。</center>"
                rs.close           
           else        
                            rs.close
                session("studentname")=request.form("studentname")
                set rs=nothing
                call endConnection()
                Response.Redirect "selectsubject.asp"
            
        end if
       end if    
        
        '用户注册
    elseif Request.Form("submit")="注    册" then      
        Response.Redirect "register.asp"
        '管理员进行管理
    elseif Request.Form("submit")="管    理" then
        Response.Redirect "admin/login.asp"        
    end if
end if
%>
这上面的代码是什么意思啊??能帮助逐句分析下吗?
4 回复
#2
letian5842008-05-10 12:47
我晕
第一行是表明使用的脚本代码语言 为Visual Basic语言
第二行使用页面缓存
第三行是调用连接数据库文件
第四行开始就是正文啦 刚开始获取用户的环境
解释太多 你想学的话建议还是自己买本书吧 没人会为这些简单点的浪费时间
#3
yms1232008-05-10 15:12
建议先把基础的看懂,再来看代码。
#4
天堂小孩2008-05-11 20:38
谢谢指教,正在买书看,没翻着这些才问的,呵呵,谢谢了。
#5
hxfly2008-05-11 21:32
学习简单ASP教程,然后看代码,然后做。
我觉得这样上手速度快。
不一定书上的东西全会了再开始写东西。我的方法是,第一本书,一定简单的不能再简单,最好就找那种按天来计算的书,比如《10天学会***》这样的,看完就做,上手快。等能做基础的东西了,如果想深入研究,再买本好书也可以,不过我建议在实践中学习,只要能上网,网络比所有书都好。遇到不会的就搜索。比干学习课本强。
1