回 帖 发 新 帖 刷新版面

主题:ASP BBS文章数问题不明请大家帮帮我

大家好
我做了一个BBS可是在计算发新文章数的同时出错误 请大家帮我看看 我再这先谢谢大家了 请看下面 这是一个提交新帖的网页
<% option explicit %>
<!--#INCLUDE FILE="uip.asp"-->
<!--#INCLUDE FILE="function.asp"-->
<head>
<title>无标题文档</title>
</head>

<body>
<table width="800" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><form name="form1" method="post" action="">
      <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="200" height="25"><div align="center">主题</div></td>
          <td height="25"><label>
            <input name="title" type="text" id="title">
          </label></td>
        </tr>
        <tr>
          <td width="200" height="100"><div align="center">内容</div></td>
          <td height="100"><label>
            <textarea name="body" cols="50" rows="5" id="body"></textarea>
          </label></td>
        </tr>
        <tr>
          <td width="200" height="25"><div align="center">发方人姓名</div></td>
          <td><label>
            <input name="user_name" type="text" id="user_name">
          </label></td>
        </tr>
        <tr>
          <td width="200" height="25"><div align="center">
            <label>
            <input type="submit" name="Submit" value="提交">
            </label>
          </div></td>
          <td>&nbsp;</td>
        </tr>
      </table>
        </form>
    </td>
  </tr>
</table>
<%
if request("title")<>"" And request("user_name")<>""then
dim title,body,layer,parent_id,child,hits,ip,user_name,forum_id
title=request("title")
body=request("body")
user_name=request("user_name")
layer=1
parent_id=0
child=0 
hits=0
ip=request.ServerVariables("REMOTE_ADDR")
dim sql,svalues
sql="insert into bbs(title,layer,parent_id,child,hits,ip,user_name,suhmit_date"
svalues= " values('" & title &"','" & layer & "','" & parent_id & "','" & child & "','" & hits & "','" & ip & "','"& user_name &"','" & Now() &"'"
if body<>""then
sql=sql&",body"
svalues=svalues&","&"'"& body & "'"
end if
sql=sql & ")"& svalues &")"
db.Execute(sql)
    Sql="Update forum Set forumcount=forumcount+1 Where id = " & forum_id
    db.Execute(Sql)
db.close
response.Redirect"ccui.asp"
end if

%>
</body>
</html>
当我提交时总是出现 
    Sql="Update forum Set forumcount=forumcount+1 Where id = " & forum_id
    db.Execute(Sql)
这句中的ID 错误 但我又不知道 那错了还请大家帮帮我
谢谢大家了

回复列表 (共7个回复)

沙发

Sql="Update forum Set forumcount=forumcount+1 Where id = " & forum_id
在这句前加上
db.close看看

板凳

谢谢 我看看

3 楼

不行呀 还是出现 语法错误 (操作符丢失) 在查询表达式 'ID =' 中。这句话 请大家在帮帮我 谢谢了

4 楼

forum_id
这个从什么地方来,我没有找到给它附值

5 楼

我定意 了变量了 用来计算发言文章数的

6 楼

Sql="Update forum Set forumcount=forumcount+1 Where id = " & forum_id
你在这下面加上
response.write sql&"<br>"&db
response.end
看看输出的是什么

7 楼

还是错 其它到是问题就是加入文章发言数 不知道怎么输入进去 那位哥们有实倒能否发一个给我 谢谢

我来回复

您尚未登录,请登录后再回复。点此登录或注册