About This Journal
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
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.
[vbnet]
‘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
[/vbnet]
Posted in .NET General Topic, Miscellaneous |
No Comments »