Hello,

I wonder if someone can help me please?

I currently have a form which is reading Names from a DB into a DatagridView.
Once a user selects one of the names, another DataGridView is populated with entries belonging to the chosen name. (Each Name can have 0-5 entries)

I then want to make changes to the data in this 2nd DataGridView and update this to the DB.

It all should be straightforward, but it's not working so I'm assuming I'm doing it wrong. (I have done very little with ADO etc so I'm more than likely missing something)

Anyway - my code to populate the 2nd DataGridView is here:

Code:
Private Sub PopulateDataGridView(GUID)
        Dim DataAdapter As New SqlDataAdapter("SELECT FIELD_A FROM TABLE_A WHERE GUID = '" & GUID & "'", connectionString)
        Dim DataSet As New DataSet
        Dim commandBuilder As New SqlCommandBuilder(DataAdapter)

        Try
            DataAdapter.Fill(DataSet, "ds")
            dgv1.DataSource = DataSet.Tables("ds")
			
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
End Sub
As you can see, when this sub is called, the person's GUID is passed in and the dataset is filled with the relevant rows.
This works fine and populates the DataGridView fine with 0-5 rows.

Assuming I amend one of the rows in the DataGridView or Add / Remove a row, I would like to just press my 'Update' button which would then write the new entries back to the DB.

This is the part I'm having trouble with.
How would I do this?

Thank you in advance.