请帮忙解决一下,谢谢!

panshijun 2003-12-19 11:10:59
我不知道怎么进行判断:我的程序代码如下:<%
dim Conn
dim sConn
dim RS
dim sRS

dim username,userpwd
username = TRIM(Request.Form("username"))
userpwd = TRIM(Request.Form("userpwd"))
set Conn = server.createObject("ADODB.CONNECTION")
set RS = server.createObject("ADODB.RECORDSET")
Conn.open "DSN=htwt;uid=appuser;pwd=now918"

sRS = "select * from onlineuser where username='" & username & "' and userpwd = '" & userpwd & "'"

RS.OPEN sRS,Conn,1,3

if RS.RecordCount >0 then
Session("username") = username
RS.Close
Conn.Close
set RS = Nothing
set Conn = Nothing
if Session("panduan") = "a" then
Response.redirect "../PAGE/MAIN.asp?frmSearch=duiC"
else
Session("panduan") = "b"
Response.redirect "../PAGE/MAIN0.asp?frmSearch=duiC"
end if
else
Session("username") = ""
RS.Close
Conn.Close
set RS = Nothing
set Conn = Nothing
end if

%>

就是怎么判断当用户名相对应的字段(panduan)为a是打开MAIN.asp?frmSearch=duiC为b是打开MAIN0.asp?frmSearch=duiC,谢谢?
...全文
29 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
shleo 2003-12-20
  • 打赏
  • 举报
回复
你的父页面的session输出正确伐
swich 2003-12-19
  • 打赏
  • 举报
回复
if Session("panduan") = "a" then
Response.redirect "../PAGE/MAIN.asp?frmSearch=duiC"
end if
if Session("panduan") = "b" then
Response.redirect "../PAGE/MAIN0.asp?frmSearch=duiC"
end if
梦幻飞鱼gz 2003-12-19
  • 打赏
  • 举报
回复
最好这样,因为Session("panduan")不一定会转成字符型

if Trim(""&Session("panduan")) = "a" then
Response.redirect "../PAGE/MAIN.asp?frmSearch=duiC"
else

angelheavens 2003-12-19
  • 打赏
  • 举报
回复
if Trim(Session("panduan")) = "a" then
Response.redirect "../PAGE/MAIN.asp?frmSearch=duiC"
else
Response.redirect "../PAGE/MAIN0.asp?frmSearch=duiC"
end if
angelheavens 2003-12-19
  • 打赏
  • 举报
回复
if Trim(Session("panduan")) = "a" then
Response.redirect "../PAGE/MAIN.asp?frmSearch=duiC"
else
panshijun 2003-12-19
  • 打赏
  • 举报
回复
那问题出在哪里呀?
shleo 2003-12-19
  • 打赏
  • 举报
回复
输出的不是a?
那是你session传递的问题啊
panshijun 2003-12-19
  • 打赏
  • 举报
回复
输出的不是A呀,有没有其他的方法呀,比如自定义函数,或者打破我现在写的程序格局。
shleo 2003-12-19
  • 打赏
  • 举报
回复
那你先把Session("panduan")输出来看看是不是a
如果是a,试试Session("panduan") = a
panshijun 2003-12-19
  • 打赏
  • 举报
回复
这样不行呀, 无论panduan中是不是a都执行 Response.redirect "../PAGE/MAIN0.asp?frmSearch=duiC"呀?
shleo 2003-12-19
  • 打赏
  • 举报
回复
if RS.RecordCount >0 then
Session("username") = username
RS.Close
Conn.Close
set RS = Nothing
set Conn = Nothing
if Session("panduan") = "a" then
Response.redirect "../PAGE/MAIN.asp?frmSearch=duiC"
else
Response.redirect "../PAGE/MAIN0.asp?frmSearch=duiC"
end if

else
Session("username") = ""
RS.Close
Conn.Close
set RS = Nothing
set Conn = Nothing
end if
panshijun 2003-12-19
  • 打赏
  • 举报
回复
我试了都不行呀?
原代码是:这样的,上面那个是我修改过的。我怎么判断不同的用户打开不同的页面呢?
<%
dim Conn
dim sConn
dim RS
dim sRS

dim username,userpwd
username = TRIM(Request.Form("username"))
userpwd = TRIM(Request.Form("userpwd"))
set Conn = server.createObject("ADODB.CONNECTION")
set RS = server.createObject("ADODB.RECORDSET")
Conn.open "DSN=htwt;uid=appuser;pwd=now918"

sRS = "select * from onlineuser where username='" & username & "' and userpwd = '" & userpwd & "'"

RS.OPEN sRS,Conn,1,3

if RS.RecordCount >0 then
Session("username") = username
RS.Close
Conn.Close
set RS = Nothing
set Conn = Nothing
Response.redirect "../PAGE/MAIN.asp?frmSearch=duiC"
else
Session("username") = ""
RS.Close
Conn.Close
set RS = Nothing
set Conn = Nothing
end if

%>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧