cnn.execute "delete 人员信息库 where 序号=2"
cnn.execute "Update 人员信息库 set 序号=序号-1 where 序号>2"

解决方案 »

  1.   

    cnn.execute "Update 人员信息库 set 序号=序号-1 where 序号>2"
    用你的方法的话我想应该是UPDATE的时候把指针又移到了首记录你把UPDATE放到LOOP后面就可以了试试看吧  直接用UPDATE 表名 SET 字段=  WHERE 是最好的方法
      

  2.   

    把Update语句换到Do循环之外,试试,
    不需要更改一条记录就更新一次,
    可以最后才更新么。
      

  3.   

    同意楼上不过原语句也可以用,在循环前加句
    rst.movefirst看看
      

  4.   

    update ...set  where 这我知道。
    因为以前在Rdo中我的程序都是这样写的,没有问题update ... set  .. where 只能更新有规律数据,我的程序中有很多下面的程序
    rst1.source="select * from table1"
    rst1.open
     do while not rs1.eof 
       rst2.source="select * from table2 where filed1=rst1!fieldx"
       rst2.open
       if rst2!fieldx='xxx' then 
         rst2的某个字段更改
         rst2.update
       end if
     rs1.movenext
    loop
    所以我只想知道出先这个问题时则么回事
      

  5.   

    我想是因为你在“select * from 人员信息库 where 序号>2”中没有指定顺序,用“select * from 人员信息库 where 序号>2 order by 序号 asc”试试看! 另外,将rst.update放在循环外面。rst.source="select * from 人员信息库 where 序号>2 order by 序号 asc"
    rst.open
    do while not rst.eof
        rst!序号=rst!序号-1
        rst.movenext
    loop
    rst.update
    请你试完以后告诉我结果如何!
      

  6.   

    好像没有问题。---------------------------------------------------------
    Montaque==Digitalboy==Houyongfeng==Monkey
      

  7.   

    To  maomaomaomao(毛 毛) 
     还是不行。死循环。
     eof 没有等于True
      

  8.   

    不好意思,把do while not rst.eof改为
               do while "序号">0
      

  9.   

    真是奇怪了~~~
    建议你用debug.print查看一下每次循环减一的是那些记录,和数据库对比一下。
    是不是不停的把同一个序号一直减到2了?