Skip to content Skip to sidebar Skip to footer

How To Select Data From Database With Many Filter Options?

I am creating C# winforms application, which connects to the Database. Because I have a many records in database, I want to filter data on sql side (Filter must have many options w

Solution 1:

You should always prefer filtering data on database instead of bringing unwanted data to your application and filtering with code.

Eg

string query = "SELECT * FROM MyTable ";

In the string below you add a WHERE clause and pairs of column = value or column = expression

 string query = "SELECT * FROM MyTable WHERE column1=somevalue AND column2 > somevalue AND ...";

Post a Comment for "How To Select Data From Database With Many Filter Options?"