注册 登录
编程论坛 ASP技术论坛

asp rs.update 问题,请教各位

jellva 发布于 2012-02-16 17:03, 721 次点击
index.asp页面主要代码
<form name="form1" method="post" action="update.asp">
<td width="30" class="listRecord"><input type="checkbox" name="id" value="<%=rs("id")%>"></td>
<input type="checkbox" onClick="this.value=check(this.form.id)"> </td>
 <td width="80" align=center nowrap style="color:black;">[全选/反选]</td>
<td width="40" nowrap>
<input type="submit" name="Submit" value="发布" >

复选框选择想要修改的书,提交到update.asp更新数据库state状态(发布/没发布)(1/0).

update.asp页面代码
<!--#include file="conn.asp"-->
<%
    set rs=server.createobject("ADODB.recordset")
    rs.open "SELECT * FROM t_book WHERE id = "&id,conn,1,3
    rs.addnew
    rs("state")=1
    rs("addtime")=now()
    rs.update
    rs.close
    set rs=nothing
    set conn=nothing
    Response.Write "<center>发布成功<br><br><br>"         
    Response.Write "<a href = index.asp>返回</a>"   
  %>
选择了的id传到update.asp更新state状态,并且更新时间,发布成功的话state赋值1,没选中的不用管,也可以赋值为0,无所谓的..反正不给人看的,只是主要把state赋值1..
请问各位高手,哪里出错了?谢谢...


3 回复
#2
jellva2012-02-17 09:26
没人会吗?对于高手来说应该很简单吧..
#3
jonathen2012-02-17 12:06
是不是报错是数据类型不对?
#4
jonathen2012-02-17 12:15
rs.open "SELECT * FROM t_book WHERE id = "&id,conn,1,3
这一句没有写完 应该是 rs.open "SELECT * FROM t_book WHERE id="&request("id")&" ",conn,1,3  嘿嘿 我也是新手 !
1