请教高手关于asp程序问题

来源:百度知道 编辑:UC知道 时间:2024/06/08 04:02:22
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from hits where id='"&request.QueryString("id")&"'",conn,1,3
rs("hit")=rs("hit")+1
rs.update
set rst=server.CreateObject("adodb.recordset")
sql="select hit,content,title,author,time from hits where id='"&request("id")&"'"
rst.open "hits",conn,1,3
%>
我从数据库里面取东西,想做个浏览统计,课时就是读不出里面的内容content,其他的字段都能读出来,哪里出错了,去掉where时就能读出来啦!为什么

应该这样写:
"select * from hits where id="&cint(request.QueryString("id"))&""
或者是
"select * from hits where id="&request("id")

id='"&request.QueryString("id")&"'字符连接错误,可以把它换成一个变量,再把ID赋与这个变量

ID里有引号,错了

你不需要open两次,在第一次open的时候读出content放在一个变量就行了,你试试