我的代码
procedure TForm5.BitBtn2Click(Sender: TObject);
begin
with Query2 do
begin
     SQL.Clear;
     SQL.Add('insert into  (sell.ID,sell.goods_id,sell.class,sell.goods_name,sell.sell_price,sell.sell_count,sell.total,sell.datetime)');
     SQL.Add('select (temptable.ID,temptable.goods_id,temptable.class,temptable.goods_name,temptable.sell_price,temptable.sell_count,temptable.total,temptable.datetime)');
     SQL.Add('from temptable');end;
end;
end.
执行的时候即不提示出错,但是内容也没有插进去,怎么回事啊?

解决方案 »

  1.   

    SQL语句如下
    select * into NEWTABLE from temptable
    两相同结构表应该就可以了
    你上面的Insert into 语句没有指定要插入数据的数据表.
      

  2.   

    我按照你的做法做了之后,结果出现了
    INSERT 语句与 COLUMN FOREIGN KEY 约束 'FK_sell_record' 冲突。该冲突发生于数据库 '1',表 'record', column 'goods_id'。
    语句已终止。
    这个错误。