asp打开新闻

来源:百度知道 编辑:UC知道 时间:2024/05/29 13:11:20
在搭建一个网站,调用新闻的asp源程序时这样写的:
<%
set content=conn.Execute("select * from news where " _
& "id = '" & Request.querystring("id") & "'")
conn.Execute"Update news set counter=counter+1 where " _
& "id = '" & Request.querystring("id") & "'"
%>

在网站主页上点新闻后 立刻跳转到(比如说)
http://127.0.0.1:81/lzs/news/?id=2页面,但是在页面还没打开的时候地址栏就突然变成
http://127.0.0.1:81/lzs/news/页面了,问题应该是上面这段代码吧,如何处理呢?先谢一个。

1、如果你没有采用URLrewirte的话,你默认的http://127.0.0.1:81/lzs/news/?id=2 应当是传入到
http://127.0.0.1:81/lzs/news/index.asp?id=2(或http://127.0.0.1:81/lzs/news/default.asp?id=2)这样的页面。。
如果你news下面没有这样的页面,那肯定是进不了的。

2、
<%
set content=conn.Execute("select * from news where " _
& "id = '" & Request.querystring("id") & "'")
conn.Execute"Update news set counter=counter+1 where " _
& "id = '" & Request.querystring("id") & "'"
%>
这样写,本身是没有错的!不过,建议还是不要换行,不用连字符。以免出错!可改成
strid=request.querystring("id")
sql1="select * from news where id='"&