一个非常奇怪的问题!!关于asp的比较运算符!!

ttoth12 2003-11-23 02:49:52

<html>
<head>
<title>删除人员</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<% if isempty(session("序号")) then
response.Write("您没有登陆!请返回<a href=""login.asp"">登陆页</a>登陆!")
response.End
end if
%>
<!--#include file="newconn.asp"-->
<p>
<%
response.Write(session("序号"))
response.Write(request.QueryString("id"))

if request.QueryString("power")="管理员" then
response.Write("不可以删除管理员!")
response.End
end if
if request.QueryString("id")<>session("序号") then
response.Write("您不可以删除别人的信息!只可以删除自己的!")
response.End
end if

con.execute "delete * from table1 where 序号="&request.QueryString("id")&""

response.Write("删除成功!")

con.close
set con=nothing


%>
</p>
<p><a href="data.asp">返回首页</a></p>
</body>

</html>


我通过程序调试输出发现 request.QueryString("id") session("序号") 是两个相等的数值,但是程序运行if request.QueryString("id")<>session("序号") then
这个判断语句总是为真,所以就是会执行response.Write("您不可以删除别人的信息!只可以删除自己的!")
response.End这2句话,我非常郁闷阿,难道是我的asp的if,else语句嵌套出现问题了阿,在线等,情大家帮忙阿!!
...全文
67 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
超级大笨狼 2003-11-23
  • 打赏
  • 举报
回复
<>区分大小写,多余空格什么的
supere 2003-11-23
  • 打赏
  • 举报
回复
最好还是

if Trim(cstr(request.QueryString("id")))<>trim(cstr(session("序号"))) then
youxuesifang 2003-11-23
  • 打赏
  • 举报
回复
类型的问题?都转换成字符串类型试一试。
if cstr(request.QueryString("id"))<>cstr(session("序号")) then
sx1123 2003-11-23
  • 打赏
  • 举报
回复
可能有空格
你试试If Trim(request.QueryString("id"))<>Trim(session("序号"))
Then
看看
a_zhe_20 2003-11-23
  • 打赏
  • 举报
回复
类型转换一下吧
如果是数字用cint(request.QueryString("id"))<>cint(session("序号"))

是字符串就cstr(request.QueryString("id"))<>cstr(session("序号"))

28,391

社区成员

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

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