Well, it's an interesting question. And somewhat it depends on how complex a search you will allow them to have. You will have to consider such things as whether they can choose the fields in the results set or only the qualifiers in the where clause. Will you allow them to filter on more than one item? Will you allow only them to use OR as well as AND if they filter on multiple items? Can they select the tables or even the database? How are you giving them rights to the datbase objects? If you create dynamic queries, then you have to issue rights at the table level not the stored procedure level in SQL Server which is much less secure.
One thing I highly recommend is finding out from the users the 5-10 most common queries they run and creating a stored procure for each and a form in the user interface that allows then to select each of these and fill in the pertinent parameter(s) for that query. Then have a button to an advanced form which will allow more dynamic creation of queries.
I suggest this because the dynamic creation of queries is never effcient and in most places there are really only a few queries that are run often. By allowing then users to do these easily you make them happy and you can optimize the queries for efficiency - something you can't do if you only have one page that allows a wide variety of advanced searches. Then you still have the advanced search for the power users. Remember most users have no idea how to query data - if they must search using a complex, dynamic form for even the simple searches, they will panic. And likely they will query incorrectly and get the wrong results because they don't understand what they are doing.
AirTraveler Search
The link above will take you to a complex search we did. The first page of it has the most common values to search on, then it has another way to search by distance, and advanced search with 30 different possible variables and finally a graphical map search.
For another project, the users could only search on one field at a time, so they got a pull down menu with all the field names and the rest of the search form changed dynamically depending onthe data type of the field they selected. String data types got a text box and radio buttons to fill in whether the user wanted to search for the exact phrase, anywhere in the in the field or the prefix or suffix. Date fieds got two formatted text boxes to choose beginning and end dates, bit fields got a yes no pulldown, etc. The user could also search from a list of proposal names (by far the most common search.) and results could be sorted on a field after getting a result set. We did this by making the column headers for the result set buttons instead of text, one click to sort in ascending order and a double click to sort in descending order.
Questions about posting. See faq183-874