首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

菜鸟想提个有关问题,希望大家能帮帮小弟我,多谢

2012-01-03 
初学者想提个问题,希望大家能帮帮我,谢谢我是用C#的,数据库是access,在数据库里有两张表,除了ID字段,其他

初学者想提个问题,希望大家能帮帮我,谢谢
我是用C#的,数据库是access,在数据库里有两张表,除了ID字段,其他的字段都一样,我想实现在点击button的时候把table1的所有内容(除ID字段的内容外)全部插入到table2相应的字段里面,格式和table1一样,请问该怎么实现呢?
比如,table1里:id设置的是自动编号
            id       name       price
            1         www         50
            2         ccc         60
点击button后实现table2里:id是自动编号,所以有可能不一样
          id         name       price
          x             www         50
          x             ccc         60
等于就是把table1里的东西除ID外全部复制到table2里去了,请问该怎么解决呢?谢谢大家

[解决办法]
insert into table2(name,price) select name,pricefrom table1
[解决办法]
直接取需要的字段插入到新表中就好了
[解决办法]
insert A( t_date,type_code,con_code) select t_date,type_code,con_code from B
[解决办法]
insert into table2(name,price) select name,price from table1
方法正确~

[解决办法]
insert into table2(name,price) select name,price from table1
-------------------------
up
[解决办法]
insert into table2(name,price) select name,price from table1
正解
[解决办法]
insert into table2(name,price) select name,price from table1
没错
[解决办法]
insert into table2(name,price) select name,price from table1
up

热点排行