Update dataset
Visual Basic
2
Posts
2
Posters
0
Views
1
Watching
-
'** Creat a dataview of the table in the dataset Dim tableView As DataView = New DataView(dataSet.Tables("TableName")) '** Filter the dataview to isolate the one row being updated Dim sb As New StringBuilder With sb .Length = 0 .Append("TableColumnName") .Append("= '") .Append("ValueOfData") .Append("'") tableView.RowFilter = .ToString End With sb = Nothing '** Do the update If tableView.Count > 0 Then '** Create a view of the row being updated Dim tr As DataRowView tr = tableView.Item(0) '** Update the columns being changed tr.Item("NameOfColumnBeingChanged") = "NewValue" tr = Nothing End If tableView = Nothing