我定义了checkbox,value是年度+id,如(2006,80),也就是说年度为2006,id为80,
如:
  表头:序号  题名   年度   id     操作
          1    2     2006   33   checkbox(value为(2006,33))
          2    3     2005   34   checkbox(value为(2005,34))
          3    4     2006   78   checkbox(value为(2006,78))
          - - - - -  - - - -- - - -- - - - - - - - - - - -
          - - - - - - - - - - - - - - - - - - - - - -  - -
                      更新按钮
选中复选框后,点击更新按钮,执行的操作是
update tableA
set flag='剔旧'
where nd='checkbox的value的前面四位' and id='checkbox的value的第五位到结束'
如(nd='2006' and id='33')
这样的功能怎么实现?
请各位多多帮忙!
谢谢!

解决方案 »

  1.   

    update tableA Set flag='剔旧'
    where nd=:year and id=:ID --而年份和ID由前台开发语言来获得这两个值。
      

  2.   

    update tableA
    set flag='剔旧'
    where nd=substring(操作,1,4 ) and id= substring(操作,6,len(操作)-5)
      

  3.   


    update tableA
    set flag='剔旧'
    where nd=Left(Value,4) and id=Right(Value,Len(Value)-4)
      

  4.   

    谢谢huailairen(流浪猫--很想养只猫,带着它到处流浪。) ,WangZWang(阿来)
    倒是你们两位提供的sql我会写
    如果是如果选中多条记录,该怎么操作呢?不知道怎么实现了,而且还要按钮响应啊。
    不会啊,请各位耐心讲解。
      

  5.   

    谢谢paoluo(一天到晚游泳的鱼)
      

  6.   

    如果選中多條,就要你用程序做個循環判斷。如果選中,就執行一次Update。
      

  7.   

    如果你的CHECKBOX是多个的话就把他建成控件数组,然后循环访问,判断他的值,如果选中就更新,反之不更新。不知道你使用的什么语言,各种语言有不同的写法,但原理基本相同。
      

  8.   

    String[] parms = request.getParameterValues("cbx");
    for (int i=0;i<parms.length;i++)
    {    String[] strAll=new String[2];
        strAll=parms[i].split(",");
        String strYear=strAll[0];
        String strID=strAll[1];
    }