没办法进行登录操作,帮忙看看哪里错了
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%><%response.buffer=true%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登录系统</title>
<style type="text/css">
<!--
#xiaohui
{
position:absolute;
width:200px;
height:115px;
z-index:1;
left: 365px;
top: 20px;
}
.STYLE14
{
font-size: 24px
}
#wenzi
{
position:absolute;
width:269px;
height:100px;
z-index:2;
left: 559px;
top: 88px;
}
.STYLE15
{
color: #0000FF;
font-weight: bold;
font-style: italic;
}
#chatu
{
position:absolute;
width:200px;
height:115px;
z-index:3;
left: 97px;
top: 208px;
}
#biaodan {
position:absolute;
width:300px;
height:206px;
z-index:4;
left: 816px;
top: 374px;
background-color: #FFFFFF;
}
.STYLE37 {
font-size: 18px;
font-style: italic;
font-weight: bold;
}
.STYLE38 {color: #0000FF}
.STYLE39 {font-size: 12px}
.STYLE40 {color: #0000FF; font-size: 12px; }
-->
</style>
<script language="JAVASCRIPT" >
<!--
function check_Null(){
if (document.form1.username.value==""){
alert("用户名不能为空!");
return false;
}
if (document.form1.pwd.value==""){
alert("密码不能为空!");
return false;
}
return true;
}
// -->
</script>
</head>
<body>
<div id="xiaohui">
<p><img src="../xiaohui.png" width="371" height="67"><span class="STYLE14"></span></p>
</div>
<div id="chatu"><img src="../chatu.jpg" width="640" height="427"></div>
<div class="STYLE14" id="wenzi"><span class="STYLE15">电子元器件管理系统</span></div>
<div id="biaodan">
<form name="form1" onSubmit="javascript:return check_Null();" action=" " method=POST>
<table width="291" border="1" bordercolor="#FFFFFF">
<tr>
<td colspan="2" bordercolor="#FFFFFF"><div align="center"><span class="STYLE37"><span class="STYLE38">用户登录/</span>LOGIN</span></div></td>
</tr>
<tr>
<td colspan="2" bordercolor="#FFFFFF"> </td>
</tr>
<tr>
<td width="134" bordercolor="#FFFFFF"><div align="right"><span class="STYLE38"><span class="STYLE39"><img src="../yonghu.png" width="13" height="15">用户名</span></span></div></td>
<td width="141" bordercolor="#FFFFFF"><label>
<INPUT size=15 name="username" class="inputbox">
</label></td>
</tr>
<tr>
<td bordercolor="#FFFFFF"><div align="right"><span class="STYLE38"><span class="STYLE39"><img src="../mima.png" width="15" height="18">密码</span></span></div></td>
<td bordercolor="#FFFFFF"><label>
<INPUT type=password size=15 name="pwd" class="inputbox">
</label></td>
</tr>
<tr>
<td bordercolor="#FFFFFF"><div align="right"><span class="STYLE40">用户类型</span></div></td>
<td bordercolor="#FFFFFF"><label>
<input type="radio" name="usertype" value="2">
<span class="STYLE40"> 老师 </span>
<span class="STYLE39"><input name="usertype" type="radio" value="1" checked>
<span class="STYLE38"> 学生</span></span></label></td>
</tr>
<tr>
<td bordercolor="#FFFFFF"><label>
</label>
<label>
<input type=submit value="登录" name=submit class="inputbutton">
</label></td>
<td bordercolor="#FFFFFF"><label>
<input type="button" value="注册" name="loginbutton" class="inputbutton" OnClick="window.open('/kill/register/reg.asp','_self')">
</label></td>
</tr>
</table>
</form>
<%
set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "Dbq="&Server.Mappath("sky.mdb")&";Driver={Microsoft Access Driver (*.mdb)};"
dim username,pwd
username=replace(trim(request("username")),"'","")
pwd=replace(trim(Request("pwd")),"'","")
usertype=replace(trim(Request("usertype")),"'","")
if username<>"" then'查有无该用户
if usertype="1" then
sql="select * FROM stu_table Where sno='" & username & "' And spwd='" & pwd & "'"
elseif usertype="2" then
sql="select * FROM tea_table Where tno='" & username & "' And tpwd='" & pwd & "'"
end if
Set rs=Conn.Execute(sql)
If Not rs.Bof And Not rs.Eof Then'登录成功
session("usertype")=usertype
if usertype=1 then
session("username")=rs("sno")
response.redirect "/kill/inquiry/inquiry.asp"
else
session("username")=rs("tno")
response.redirect "/kill/inquiry/teacher.asp"
end if
Else
response.write "对不起,用户名或密码有误,请重新登录"
End If
end if
%>
</div>
</body>
</html>
没办法连接数据库进行登录操作,请高手帮忙看看
[ 本帖最后由 陈休 于 2010-4-14 16:20 编辑 ]