session("type")这是后来修改的时候添加的,前面都没有涉及这个
type是数据库中用户表的一项,内容是1,2,3数字
[此贴子已经被作者于2005-12-28 13:58:42编辑过]
雪弧,改成这样试试:
myAccount = trim(request("username"))
myPass = trim(replace(request("Password"),"'",""))
set Conn = Server.CreateObject("Adodb.Connection")
Connstr = "Driver={SQL Server};Server=cylong;UID=sa;PWD=;Database=生产管理"
Conn.open connstr
CheckSql = "SELECT * FROM 用户 WHERE 用户名 = '"&myAccount&"'"
set checkRs = Server.CreateObject("Adodb.Recordset")
checkRs.Open CheckSql,Conn,1,1
if checkRs.eof then
response.write "<script language=javascript>alert('对不起用户不存在');history.back(-1)</script>"
else
if checkRS("密码") = '"&myPass&"' then
session("TYPE")=checkRs("types")
else
response.write "<script language=javascript>alert('对不起密码错误');history.back(-1)</script>"
end if
end if
checkRs.close
conn.close
Select Case session("type")
Case "1"
response.redirect "1.asp"
Case "2"
response.redirect "2.asp"
Case "3"
response.redirect "3.asp"
end select
[此贴子已经被作者于2005-12-28 14:54:18编辑过]
重新修改了下
<!--#include file="xh_conn.asp"-->
<%
myAccount = trim(request("username"))
myPass = trim(request("Password"))
set Conn = Server.CreateObject("Adodb.Connection")
Connstr = "Driver={SQL Server};Server=cylong;UID=sa;PWD=;Database=生产管理"
Conn.open connstr
CheckSql = "SELECT * FROM 用户 WHERE username = '"&myAccount&"' AND Password = '"&myPass&"'"
set checkRs = Server.CreateObject("Adodb.Recordset")
checkRs.Open CheckSql,Conn,1,1
if checkRs.eof then
response.write "<script language=javascript>alert('对不起密码输入错误');history.back(-1)</script>"
end if
session("type")=checkRs("type")
checkRs.close
conn.close
Select Case session("type")
Case "1"
response.redirect "aa.asp"
Case "2"
response.redirect "bb.asp"
Case "3"
response.redirect "cc.asp"
end select
%>
添加了session("type")=checkRs("type")
但是还是和以前一样,停留在xh_cklogin.asp的空白页面啊
2006年4月4日我按照caiyakang所说写会停留在空白页上,到底应该怎么写?
2006年4月4日.我也做了同样的页面,2006年4月5日上午实验成功了.我用的if then,也可以用Select Case.
我改的程序如下:
<!--#include file="xh_conn.asp"-->
<%
myAccount = trim(request("username"))
myPass = trim(request("Password"))
mytype = request("type") '取用户类型
set Conn = Server.CreateObject("Adodb.Connection")
Connstr = "Driver={SQL Server};Server=cylong;UID=sa;PWD=;Database=生产管理"
Conn.open connstr
CheckSql = "SELECT * FROM 用户 WHERE 用户名 = '"&myAccount&"' AND 密码 = '"&myPass&"'"
set checkRs = Server.CreateObject("Adodb.Recordset")
checkRs.Open CheckSql,Conn,1,1
if checkRs.eof then
response.write "<script language=javascript>alert('对不起密码输入错误');history.back(-1)</script>"
else
session("type") = mytype
if mytype = "1" then '1为option中的value值,若不注意会出错!
response.redirect "1.asp"
elseif mytype = "2" then '2为option中的value值,若不注意会出错!
response.redirect "2.asp"
elseif mytype = "3" then '3为option中的value值,若不注意会出错!
response.redirect "3.asp"
end if
end if
%>
[此贴子已经被作者于2006-4-5 11:53:39编辑过]