日期:2014-05-17  浏览次数:21149 次

下面这段代码是什么意思 ?
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]
------解决方案--------------------
VBScript 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

------解决方案--------------------
探讨
VBScript code

m_ID = Request.QueryString("ID")//获取参数
if Request.QueryString("action")="count" then//判断ACTION动作 如果为COUNT 执行数据库更新操作
m_SQL = "UPDATE news SET viewcount=viewcount+1 WHERE newsid=" ……

------解决方案--------------------
判断是否增加新闻访问量
是 当然访问量加1
否 显示当然访问量