I have various windows forms applications that contain various controls that build up custom "group by" and "where" clauses for my class methods.
I am thinking to pass a collection structure of some kind in order for the methods to be able to build the group by's and the where clauses.
Let's say a list containing the field and the value for the group by or where.
Am I going to the right direction?
I dont have code yet but let me try to explain better:
- We have a form with 10 dropdownlists and a checkmark beside them.
- Also we have adatagrid on the form.
Every dropdownlist corresponds to a field in a table.
If a dropdownlist has its checkbox checked means that it must be part of the group by clause in the select statement.
The value of the dropdownlist must be part of the where clause.
*note: * Another application could have different numbers of dropdownboxes and different corresponding fields.
I want to create a common method that will retrieve data with user selectable group by and where clauses.
So what i think is to pass to the method 2 lists.
One with (fieldname, value) for the where clauses
And one with (fieldname) for the group by
depending on the logic above...
I hope this is more clear.