谁能帮帮迷途的ASP小鸟

来源:百度知道 编辑:UC知道 时间:2024/09/28 08:12:19
如某篇文章多少人看过,网页上能显示出来, 怎么写?

这是我的数据库:
<%
rs.update
set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news where type='新闻通知' order by id desc ",conn,1,1
if rs.eof and rs.bof then
response.Write("还没有添加新闻通知,请添加!")
else
do while not rs.eof
rs("count")=rs("count")+1
%>

这个是记录 rs("count")=rs("count")+1

显示是<%=rs("count")%>

但是为什么不行啊

送分 我就这么点分
不用那么费事,1个SQL语句搞定。
conn.execute("update news set [count] = [count] + 1 where id in (select top 8 id from news where type='新闻通知' order by id desc)")

这个不行哇?

rs.open "select * from news where id="&id,conn,1,1
是以只读方式打开数据表,
rs.open "select * from news where id="&id,conn,1,3
以可读写的方式打开的。

要 update

没有写更新语句~~~~
rs.update写在 rs("count")=rs("count")+1后面
还有把rs.open"XXX",conn,1,1改成1,3

不用那么费事,1个SQL语句搞定。
conn.execute("update news set [count] = [count] + 1 where id in (select top 8 id from news where type='新闻通知' order by id desc)")