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

DataGrid控件中的数据写到另一个表中:(这是几个表读出来的)解决思路

2012-03-02 
DataGrid控件中的数据写到另一个表中:(这是几个表读出来的)DataGrid控件中的数据写到另一个表中:(DataGrid

DataGrid控件中的数据写到另一个表中:(这是几个表读出来的)
DataGrid控件中的数据写到另一个表中:(DataGrid 中是几个表读出来的)

物品 数量

手机 10

电脑 23

毛巾 11

 

我想将其写入一个新的数据库表1中

 

物品 数量

 

 

请大家帮助,谢谢



[解决办法]
用ado,sql为
select 物品,数量 into 表1 from 表
将 Adodc1.RecordSource 的sql直接改成上句的形式,用ado执行即可
[解决办法]
自己看着办吧.

VB code
    DataGrid1.Row = 0    i = 1    Do While DataGrid1.Row >= 0        If i = DataGrid1.Row Then Exit Do        i = DataGrid1.Row        cn.execute "insert into table1(字符字段1,数值字段2) values '" & DataGrid1.Columns(0).Text & "'," &  DataGrid1.Columns(1).Text         DataGrid1.Row = DataGrid1.Row + 1    Loop 

热点排行