Friday, August 23, 2013

how to delete a row from dataset / datatable based on a condition

some times we need to manipulate the dataset or datatable returned from database

Dim SqlDS As New DataSet
For Each row As DataRow In ds.Tables(0).Rows
    If row.Item("Id") <> "blabla" Then
        row.Delete()
    End If
Next

ds.Tables(0).AcceptChanges()

No comments:

Post a Comment