下面这段代码是什么意思 ?
m_ID = Request.QueryString("ID")
if Request.QueryString("action")="count" then
m_SQL = "UPDATE news SET viewcount=viewcount+1 WHERE newsid=" & m_ID
conn.Execute(m_SQL)
else
m_SQL = "SELECT viewcount FROM news WHERE newsid=" & m_ID
Set rs = conn.Execute(m_SQL)
response.write "document.write("&rs(0)&");"
rs.Close
end if
[解决办法]
[code=JAVAScript]
m_ID = Request.QueryString("ID")//读取参数
if Request.QueryString("action")="count" then//判断参数是否为count
m_SQL = "UPDATE news SET viewcount=viewcount+1 WHERE newsid=" & m_ID //更新数据库
conn.Execute(m_SQL)
else
m_SQL = "SELECT viewcount FROM news WHERE newsid=" & m_ID//查询
Set rs = conn.Execute(m_SQL)
response.write "document.write("&rs(0)&");"
rs.Close
end if
[/code]
[解决办法]
m_ID = Request.QueryString("ID")//获取参数 if Request.QueryString("action")="count" then//判断ACTION动作 如果为COUNT 执行数据库更新操作 m_SQL = "UPDATE news SET viewcount=viewcount+1 WHERE newsid=" & m_ID conn.Execute(m_SQL) else//否则找到NEWS表里对应M_ID的值并读出NEWS表里VIEWCOUNT字段的内容 m_SQL = "SELECT viewcount FROM news WHERE newsid=" & m_ID Set rs = conn.Execute(m_SQL) response.write "document.write("&rs(0)&");" rs.Close end if
[解决办法]