L liugaohui Unregistered / Unconfirmed GUEST, unregistred user! 2007-12-07 #1 用access数据库,有两个表a表和b表,a表和b表结构完全相同,用ADOQuery1对a表进行查询,将符合要求的记录写入b表,当然写入前清空b表的以前记录<br><br><br>谢谢回复!
W weichao9999 Unregistered / Unconfirmed GUEST, unregistred user! 2007-12-07 #2 delete table b<br>insert into b (field1,field2,field3) select field1,field2,field3 from a where 条件
delete table b<br>insert into b (field1,field2,field3) select field1,field2,field3 from a where 条件
Z zhengjp Unregistered / Unconfirmed GUEST, unregistred user! 2007-12-07 #3 select * <br>into B表<br>from A表<br>where.......
D dtboyi Unregistered / Unconfirmed GUEST, unregistred user! 2007-12-07 #6 (1) delete table b<br> select * into b from a where 条件<br>(2) delete from b<br> insert into b select * from a where 条件
(1) delete table b<br> select * into b from a where 条件<br>(2) delete from b<br> insert into b select * from a where 条件
L liugaohui Unregistered / Unconfirmed GUEST, unregistred user! 2007-12-07 #7 with ADOQuery1 do<br> begin<br> sql.Clear;<br> sql.Add('delete * from 表b);<br> sql.Add('insert into 表b select * from 表a where 。。。。。。');<br> execsql;<br> active:=true;<br> end;<br><br>1、怎么判断已经经是空表,如果已经是空表,是不是删除就会出错?<br>2、添加时为什么总是说主键等有重复?<br>3、谢谢以上各位朋友!<br>4、谢谢回复!<br>请问为什么总出错呢?
with ADOQuery1 do<br> begin<br> sql.Clear;<br> sql.Add('delete * from 表b);<br> sql.Add('insert into 表b select * from 表a where 。。。。。。');<br> execsql;<br> active:=true;<br> end;<br><br>1、怎么判断已经经是空表,如果已经是空表,是不是删除就会出错?<br>2、添加时为什么总是说主键等有重复?<br>3、谢谢以上各位朋友!<br>4、谢谢回复!<br>请问为什么总出错呢?
L limin1984x Unregistered / Unconfirmed GUEST, unregistred user! 2007-12-07 #8 老大,你要先删除了在添加呀<br>with ADOQuery1 do begin<br> close;<br> sql.Clear;<br> sql.Add('delete * from b);<br> execsql;<br><br> close;<br> sql.clear;<br> sql.Add('insert into b select * from a where 。。。。。。');<br> execsql;<br><br> close;<br> sql.clear;<br> sql.Add('select * from b');<br> open;<br> end;
老大,你要先删除了在添加呀<br>with ADOQuery1 do begin<br> close;<br> sql.Clear;<br> sql.Add('delete * from b);<br> execsql;<br><br> close;<br> sql.clear;<br> sql.Add('insert into b select * from a where 。。。。。。');<br> execsql;<br><br> close;<br> sql.clear;<br> sql.Add('select * from b');<br> open;<br> end;
D dtboyi Unregistered / Unconfirmed GUEST, unregistred user! 2007-12-08 #9 楼上也不全对,<br>delete * from b,这是错误的, 应该是delete from b 即把b表清空