变量到另一页不能附值

mqgds 2010-07-10 11:41:55
index.asp页为
<%
dim buyrs,buysql
set buyrs=server.createobject("adodb.recordset")
buysql="select * from Announce"
buyrs.open buysql,conn,1,1
accid=buyrs("announceid")
do while not buyrs.eof
%>
<a href="announce.asp?annid=<%=buyrs("announceid")%>"><%=buyrs("Content")%><%=buyrs("UpdateTime")%><br /></a>
<%
buyrs.moveNext
loop
buyrs.close
set buyrs=nothing
%>
annid通过URL传递给announce页

announce.asp页为

<%
actionid=trim(request(annid))
if actionid = "" or not IsNumeric(actionid) then
response.write "非法提交数据"
else
%>

<%
Dim rscontent,sqlcontent
set rscontent = server.CreateObject("Adodb.Recordset")
sqlcontent = "select * from Announce where AnnounceID = "&actionid
rscontent.open sqlcontent,conn,1,1
%>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><%=rscontent("content")%></td>
</tr>
</table>
<%end if%>
到了这一页,始终就显示"非法提交数据",annid根本就没被附值!
这样如何处理啊
...全文
76 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
mqgds 2010-07-10
  • 打赏
  • 举报
回复
就是前面定义了一个 dim actionid
mqgds 2010-07-10
  • 打赏
  • 举报
回复
如果 actionid=trim(request.queryString("annid")) 且 actionid 是数字,

if actionid = "" or not IsNumeric(actionid) then

这个判断没有问题的。。

你把actionid 在这个判断之前打印出来看看

这个判断之前就没有了啊,如何判断之前呢
竹贤侄 2010-07-10
  • 打赏
  • 举报
回复
actionid=trim(request(annid))
if actionid = "" or not IsNumeric(actionid) then
response.write "非法提交数据,"&actionid
else


把Actionid输出来看年进什么玩意儿,就知道是什么原因了.
mqgds 2010-07-10
  • 打赏
  • 举报
回复
Dim ScriptName:ScriptName = Trim(Request.ServerVariables("SCRIPT_NAME"))
猜我是几娃 2010-07-10
  • 打赏
  • 举报
回复
如果 actionid=trim(request.queryString("annid")) 且 actionid 是数字,

if actionid = "" or not IsNumeric(actionid) then

这个判断没有问题的。。

你把actionid 在这个判断之前打印出来看看
mqgds 2010-07-10
  • 打赏
  • 举报
回复
url连接地址是http://127.0.0.1/Member/announce.asp?annid=3
本机测试的,annid=3 3代表SQL数据库里的AnnounceID
猜我是几娃 2010-07-10
  • 打赏
  • 举报
回复
把运行后的 url 链接地址 连同参数 发来看看
就是你参数的问题
mqgds 2010-07-10
  • 打赏
  • 举报
回复
还是不行啊,同样提示"非法提交数据",
jianshao810 2010-07-10
  • 打赏
  • 举报
回复
actionid=trim(request.queryString("annid"))

url 是什么样子的?
猜我是几娃 2010-07-10
  • 打赏
  • 举报
回复
actionid=trim(request.queryString("annid"))

28,391

社区成员

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

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