在一个ACCESS数据库中有两个表,把yewu中的一条数据,移动到wanchengyewu表中去,并删除yewu表中的数据。是adoquery控件,SQL怎么写,请详细点,我是新手

解决方案 »

  1.   

    adocommand1.commandtext:='insert wanchengyewu select * from yewu where 条件';
    adocommand1.execute;
    adocommand1.commandtext:='delete yewu where 条件';
    adocommand1.execute;
      

  2.   

    Sql.Text := (用 Sql.Add()加入)insert into wanchengyewu select * from yewu where ...
    delete from yewu where ...
    ExecSql 
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    adoquery2.SQL.Add('insert into wanchengyewu select * from yewu where  id=1');
    adoquery2.ExecSQL;
    adoquery1.SQL.Add('delete from yewu where id=1');
    adoquery1.ExecSQL;
    end;
    end.我这么写的,它说我FROM子语句错误
      

  4.   

    提示:你可以将上面的语句复制到Access中去执行一下,如果在那里能执行的话再把语句拷回来。我一般没有把握的语句都是先在数据库中执行后得到自己需要的结果时才将语句写到Delphi中的Query的!而且在Access中报告的错误都比较专业和准确。我估计你的错是列数不匹配,你上面的语句要求两个表的结构是一模一样的呢!
      

  5.   

    在ACCESS中好像没地方输入SQL语句的?
      

  6.   

    如果表不存在就用:create tabel ...select ....
      

  7.   

    我把程序打包了大家看看
    http://guanggaoren.com/test/test.exe