Kadjo

SoftDev Journal

About This Journal

24 June 2007 by Jojo Makiling

Technical concerns tend to find a solution as long as there are good people working on them. And Linux has the very best. - Linus Torvalds

Overcoming RowFilter and Select Limitation

May 26th, 2006 by pepesmith

In ADO.NET, you can use the DataView.RowFilter property and the DataTable.Select method to filter a subset of records. However, the expressions that you can use have limitations. This article demonstrates three techniques to work around the limitations of the filter expressions.

'DataTable1 is an existing DataTable object.
DataTable1.Columns.Add("Flag", GetType(Boolean))
DataTable1.Columns("Flag").ColumnMapping = MappingType.Hidden
Dim dr As DataRow
For Each dr In DataTable1.Rows
  ' If the criteria are satisfied Then
      dr("Flag") = True
  ' End If
Next
Dim dv As New DataView(DataTable1, "Flag = True", "", DataViewRowState.CurrentRows)
DataGrid1.DataSource = dv

Posted in .NET General Topic, Miscellaneous | No Comments »