with adoquery2 do
     begin
         close;
         sql.Clear ;
         sql.Add('update 计算机1 ');
         sql.Add('set zaiji_num="40"');
         execsql;end;
open 用于有返回记录的操作
insert update delete用execsql

解决方案 »

  1.   

    with adoquery2 do
         begin
             active;=false
             sql.Clear ;
             sql.Add('update 计算机1 ');
             sql.Add('set zaiji_num=40');
             execsql;
         end;
      

  2.   

    begin
      strsql:='update '+tablename1;
      strsql:=strsql+'set zaiji_num=40';
       with adoquery2 do
         begin
             close;
             sql.Clear ;
             sql.Add(strsql);
             execsql;
      end;
    end;运行时系统说updata语句的语法错误各位帮我看一下
      

  3.   

    tablename1后要加一个空格,这样应该行的:
    begin
      strsql:='update '+tablename1;
      strsql:=strsql+‘ set zaiji_num=40';
       with adoquery2 do
       begin
         close;
         sql.Clear ;
         sql.Add(strsql);
         execsql;
       end;
    end;
    记住跟踪调试一下,看看SQL语句是否正确?
      

  4.   

    with adoquery2 do
         begin
             close;
             sql.Clear ;
             sql.Add('update 计算机1 ');
             sql.Add('set zaiji_num="40"');
             open;
    end;我认为这主要是你的sql 语句的写法有问题。
    你不是要更新“计算机1”吗?那你也得有个条件的限制,这样笼统的写出,可能连自己都不知到要更新什么了吧!应该再加一条件:
    with adoquery2 do
         begin
             close;
             sql.Clear ;
             sql.Add('update 计算机1 ');
             sql.Add('set zaiji_num='40'');         sql.Add(‘where tiaojian='    '');
             execsql;
      
    end;