delete 表 where 记录编号 in(1,2,3,4)

解决方案 »

  1.   

    建议在表建一个唯一字段,在隐含域里标记delete table where 唯一字段 in (1,2,3,4)
      

  2.   

    delete from 表 where 记录编号 in(1,2,3,4)
      

  3.   

    举例
    如在asp中:
    记录一:<input type="checkbox" name="id" value=1>
    记录二:<input type="checkbox" name="id" value=2>
    记录三:<input type="checkbox" name="id" value=3>
    记录四:<input type="checkbox" name="id" value=4>
    提交后页面:
    id=request.form("id")
    conn.execute "delete yourtable where id in (" & id & ")"
      

  4.   

    增加:
    先在前台将多条记录存为数组中,然后通过循环insert来添加到数据库中。如(asp):
    for i=0 to ubound(a)
       sql=sql & "insert into yourtable(a) values(a(i)) "
    next
    conn.execute(sql)
      

  5.   

    写错了。增加:
    先在前台将多条记录存为数组中,然后通过循环insert来添加到数据库中。如(asp):
    for i=0 to ubound(a)
       sql=sql & "insert into yourtable(a) values('" & a(i) &"') "
    next
    conn.execute(sql)如果要修改多条记录,可以先将多条记录的id号码也存如数组,要跟其他字段对应。
    然后update的时候就可以
    sql=sql & "update yourtable set a='" & a(i) & "',b='" & b(i) & "' where id=" & id(i)
      

  6.   

    补充:添加事务代码:
    sql="begin tran "
    for i=0 to ubound(a)
       sql=sql & "insert into yourtable(a) values(a(i)) "
    next
    sql=sql & " commit tran"
    conn.execute(sql)
      

  7.   

    id=request.form("id")
    conn.execute "delete yourtable where id in (" & id & ")"