更新–添加字段– Datagrid使用BindingSource(不使用SQL) [英] Update –add field – Datagrid use BindingSource (not use SQL)

查看:63
本文介绍了更新–添加字段– Datagrid使用BindingSource(不使用SQL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,如下所示:我有一个数据库,其中包括3个表:TBLHocVien,TBLDiem,TBLDiemDanh,所有这些表均具有按字段表示的关系:MaHV.
1.我与此数据库建立了连接,但是我没有使用Command SQL.我使用VB.Net 2005中的向导建立了到数据库的连接.

我通过VB.net添加行,编辑,删除或更新,就可以了.但是后来我通过Access打开了数据库,并添加了一些表或字段,然后VB.net中的数据集看不到.那么,如何通过以下方式添加字段或表:BindingSource?
例如:

I have a problem as below: I have a Database, which includes 3 Tables: TBLHocVien, TBLDiem, TBLDiemDanh, all of these Tables have a Relationship by Field: MaHV.
1. I make a Connection with this database, but I don’t use Command SQL. I make a connection to the Database using Wizard in VB.Net 2005.

I Add a Row, Edit, Delete, or Update by VB.net and it’s OK. But then I opened the Database by Access and I added more a few Table or Field, then Dataset in VB.net don''t see that. So How do I add Field or Table by ways : BindingSource ?
Ex :

Me.Validate()
Me.TBLDIEMDANHBindingSource.EndEdit()
Me.TBLDIEMDANHTableAdapter.Update(Me.DatabaseDataSet.TBLDIEMDANH)



2.第二个问题是:当我在Window DataSource中编辑DataSet时
而且我通过查询的方式向表TBLDiem添加了更多的列:TenHV表格表TBLHocVien:

结果:TenHV列显示在DataGrid上.但是当我运行时,我在DataGrid上编辑了Column值.我更新到数据库,什么都没有.我不能我使用:



2. The Second Problem is : when I edit DataSet in Window DataSource

And I add more a Column : TenHV Form Table TBLHocVien to Table TBLDiem by ways Query :

The result : Column TenHV show on DataGrid OK. But when I Run and I edit value Column on DataGrid. And I Update to Database, it’s nothing. I can’t. I use:

Me.Validate()
Me.TBLDIEMDANHBindingSource.EndEdit()
Me.TBLDIEMDANHTableAdapter.Update(Me.DatabaseDataSet.TBLDIEMDANH)


‘第3行出现错误,因为它没有更新.那么,如何更新数据库?

3.我想要:当我将值添加到表TBLHocVien中时,该值也将添加到表TBLDiem中.我可以使用BindingSource.Copy()吗?
我需要你的帮助.非常感谢!

对不起大家!我是VietNamese,所以我有很多语法错误!
---编辑kschuler:清理链接和一些语法.


‘Error in line 3, Because it hasn’t Update. So How can I update to database ?

3. I want: When I add a value to table TBLHocVien then that value add to table TBLDiem, too. Can I use BindingSource.Copy() ?
I need your help. Thank you very much !

Sorry everybody ! I''m VietNamese, So I had many grammar mistake !
---Edit kschuler: cleaned up links and some grammar.

推荐答案

nhung ban khong su dung Sql ban co su dung qua数据集
nhung ban khong su dung Sql ban co the su dung qua dataset


这篇关于更新–添加字段– Datagrid使用BindingSource(不使用SQL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆