中国网管论坛's Archiver

网者 发表于 2006-11-4 09:48

您好帮忙看一下这段代码好吗,谢谢,难了一天了

[size=4]if not (rs.bof and rs.eof) then
[u]if trim(rs("userid"))=1 then
[/u]rs.close
set rs=nothing
response.redirect "index.asp"
else
  response.write "错"
end if
end if[/size]
[size=4]您好,我利用rs提取的数据库中的一端内容,我是希望当rs中的数据段userid=1时,跳转到index.asp,当userid=2时,跳转到index2.asp,您帮忙看一下哪儿错了,谢谢[/size]

网者 发表于 2006-11-7 15:29

呵呵已经解决
<!--#include file=yt_conn.asp-->
<%
   dim user,pass
user=request.form("username")
pass=request.form("password")
set rs=server.createobject("adodb.recordset")
rs.open "select * from user where username='"&user&"' and password='"&pass&"'" ,conn,1,1
if rs.eof or rs.bof then
response.write "<script>alert('用户名或密码错误');location.href='login.asp'</script>"
else
if not (rs.bof and rs.eof) then
if rs("userid")=1 then
session("pass")=trim(rs("userid"))
rs.close
set rs=nothing
response.redirect "index.asp"
else
if rs("userid")=2 then
session("pass")=trim(rs("userid"))
rs.close
set rs=nothing
response.redirect "index2.asp"
else
if rs("userid")=3 then
session("pass")=trim(rs("userid"))
rs.close
set rs=nothing
response.redirect "index3.asp"
else
if rs("userid")=4 then
session("pass")=trim(rs("userid"))
rs.close
set rs=nothing
response.redirect "index4.asp"
else
response.write "错"
end if
end if
end if
end if
end if
end if
%>
这是代码,敬请高手指教

lygcqy 发表于 2007-1-8 10:52

正在学习中

liming566 发表于 2007-2-6 10:12

asp还没学呢。

页: [1]

Powered by Discuz! Archiver 6.1.0  © 1999-2008 bbs.bitsCN.com