This project is read-only.

filter datagrid by contents of cell?

Jun 20, 2010 at 10:26 PM

Is there an approach to filtering the contents of a datagrid that has been loaded from a sql query (Access database in this case), based on the contents of the particular cell, similar to what Access currently allows you to do?  I can see obtaining the contents of the cell, setting a where clause to the SQL, and re-querying the database.   Are there other, preferred methods, working entirely with the datagrid?  Any code examples in C# much appreciated.

Thanks in advance

Dick Males

Cincinnati, OH USA


Jun 21, 2010 at 1:19 PM

There are trade-offs for doing this kind of thing with or without accessing database.

Usually DBs are much better tuned for filtering and sorting records. You can easily do that by simple for-loop, but that works only for less than 1k rows, which immediately poses some performance metrics on your program.