无法让我的 datagridview 写回 MS Access 数据库
我正在使用 MS Access 2003 和 vb.net 开发库存管理的 Windows 应用程序。
我在表单中使用了 datagridview 并使用 FillBytoolstrip 选项,可以使用类型过滤数据。
但我不知道如何更新数据库以反映 gridview 中的最新更改。
尝试搜索但找不到正确且有组织的答案。
你能帮我解决这个问题吗?
以下是我使用过的代码。我对此很陌生。请帮忙!!
Private Sub BOM_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.PartnoTableAdapter.Fill(Me.HemDatabase1DataSet3.partno)
End Sub
Private Sub FillByToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FillByToolStripButton.Click
Try
Me.PartnoTableAdapter.FillBy(Me.HemDatabase1DataSet3.partno, TypeToolStripTextBox.Text)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
I am using MS Access 2003 and vb.net to develop a windows application of inventory management.
I have used datagridview in the form and using FillBytoolstrip option, can filter data using type.
But i have no idea as to how can i update the database to reflect the latest changes in the gridview.
Tried searching but could not find proper and organised answer.
Could you please help me out with this ??
following is the code I have used. I am new to this. Please help !!
Private Sub BOM_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.PartnoTableAdapter.Fill(Me.HemDatabase1DataSet3.partno)
End Sub
Private Sub FillByToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FillByToolStripButton.Click
Try
Me.PartnoTableAdapter.FillBy(Me.HemDatabase1DataSet3.partno, TypeToolStripTextBox.Text)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已经设置了 TableAdapter
PartnoTableAdapter
来执行数据库读取(使用Fill
和FillBy
方法)。使用相同的 TableAdapter 通过其
Update
方法写回数据库。You have set up a TableAdapter
PartnoTableAdapter
to do the database reads (usingFill
&FillBy
methods).Use the same TableAdapter to write back to the database using its
Update
method.