VB中datagrid中导入的数据怎么修改

来源:百度知道 编辑:UC知道 时间:2024/06/02 18:35:48
就是直接在datagrid中直接修改
也就是要在 编程运行的时候 直接在datagrid中直接修改
是不是要重新编程才能得以修改

我的数据库样式
编号 地区 年龄 性别 身高 胸围 腰围 臀围
1 北京 30 男 175 88 76 90
2 天津 25 男 170 87 75 90
3 石家庄 20 男 172 89 77 92

编号 自动编号
地区 性别 文本类型
其他的都是 数字类型 双精度

应经用ADODC控件导入 在dategrid中显示出来了
剩下就是修改、添加、删除

还有就是 数据库 已经做好 怎么 再增加“列”(在不修改数据库的情况下 直接用 VB添加) 如 添加 “臂长”这一列

make a dataadapter to update
example:
dim conmntr as string="the provider address"
dim stqlstr as string="the sql statement"
dim dt as new datatable()
Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr, connStr)
dataAdapter.Fill(dt)
dataAdapter.Dispose()

remember tick the datagrid属性中有选择的。修改、添加、删除
then
make any changer include insert,delete or update can be use by
dataAdapter.update=dt
(maybe some mistake here because i am not really remember the update command,if u can not handle this please pm me and i will help you to check the correct the code)

datagrid属性中有选择的。修改、添加、删除 都可以实现。不过前提是本窗体连接的你要操作的表