如何在datagridview中保存已绑定到数据表的已更改数据

时间:2016-07-14 03:06:58

标签: vb.net datagridview datatable

您好我想知道如何使用按钮来保存对datagridview中的order_status列所做的更改,该列绑定到数据表。我发现了一些类似的东西但是我在设法调整代码时感到困惑。请尽可能简单地解释,因为我是一个完整的新手,但任何帮助将不胜感激!

Public Class processorders
    Dim sql As New sqlcontrol
    Dim dset As New DataSet1


    Private Sub Settings_Load(sender As Object, e As EventArgs) Handles Me.Load
        'This line of code loads data into the 'DataSet1.DataTable1' table
        Me.DataTable1TableAdapter.Fill(Me.DataSet1.DataTable1)
        'this line centers screen
        Me.CenterToScreen()
    End Sub

    Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click

    End Sub

    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub
End Class

form

1 个答案:

答案 0 :(得分:0)

网格ID无关紧要。如果DataTable包含更改,则通过在您调用Update的同一个表适配器上调用Fill来保存它们,以便首先检索数据。