清单 6. 标识更改的行并保存更改。
Dim oDataRow As DataRow
Dim oChangeDT As DataTable
'Get DataTable with only changed rows
oChangeDT = oEmployeeDT.GetChanges()
'Save button s/b disabled until a change is made
If oChangeDT Is Nothing Then
Exit Sub
End If
'Loop thru changed rows, make db updates
For Each oDataRow In oChangeDT.Rows
Select Case oDataRow.RowState
Case DataRowState.Added
'Insert code here
Case DataRowState.Modified
'Update code here
Case DataRowState.Deleted
'Delete code here
