1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| Private Sub Button_MAJ_Click(sender As Object, e As EventArgs) Handles Button_MAJ.Click
Dim deletedChildRecords As LudothequeDataSet.T_JeuxDataTable =
CType(Me.LudothequeDataSet.T_Jeux.GetChanges(Data.DataRowState.Deleted), LudothequeDataSet.T_JeuxDataTable)
Dim newChildRecords As LudothequeDataSet.T_JeuxDataTable =
CType(Me.LudothequeDataSet.T_Jeux.GetChanges(Data.DataRowState.Added), LudothequeDataSet.T_JeuxDataTable)
Dim modifiedChildRecords As LudothequeDataSet.T_JeuxDataTable =
CType(Me.LudothequeDataSet.T_Jeux.GetChanges(Data.DataRowState.Modified), LudothequeDataSet.T_JeuxDataTable)
Try
If deletedChildRecords IsNot Nothing Then
T_JeuxTableAdapter.Update(deletedChildRecords)
End If
T_JeuxTableAdapter.Update(Me.LudothequeDataSet.T_Jeux)
If newChildRecords IsNot Nothing Then
T_JeuxTableAdapter.Update(newChildRecords)
End If
If modifiedChildRecords IsNot Nothing Then
T_JeuxTableAdapter.Update(modifiedChildRecords)
End If
Me.LudothequeDataSet.AcceptChanges()
' MessageBox.Show(LudothequeDataSet.Tables("T_Jeux").Rows(0).Item("Age").ToString)
Catch ex As Exception
MessageBox.Show("Erreur")
Finally
If deletedChildRecords IsNot Nothing Then
deletedChildRecords.Dispose()
End If
If newChildRecords IsNot Nothing Then
newChildRecords.Dispose()
End If
If modifiedChildRecords IsNot Nothing Then
modifiedChildRecords.Dispose()
End If
End Try
End Sub |
Partager