One way to do the filtering is to repopulate the underlying data from the database. However, depending on the situation this may be both time and resource consuming.
Other possibilities are for example:
If you're using for example
BindingSource
, you can apply a filter on it. This way the data remains the same but only the relevant portion is shown. For more information, see:
BindingSource.Filter Property [
^]
If you fetch the data into a
DataTable
from the database you can define a
DataView
which filters the desired rows from your DataTable and assign that view as your datasource to a grid etc. More information:
DataView.RowFilter Property [
^]
The expressions you can use are listed in
DataColumn.Expression Property [
^]