title: Best technique to build a dynamic select
body: <p>I have several filter fields in a form that will build the where expression of a select statement that will populate a <code>GridView</code>. The user also can choose the operators ( > &lt; >= &lt;= like) for each field . I would like to know the best technique to accomplish this task considering the pros and cons.</p>
  
  <p>I got to some conclusions:</p>
  
  <ul>
  <li>Linq: not flexible to work with several possibilities and several operators.</li>
  <li>Stored Procedure: Make several parameters in a proc and in the where clause make <code>(table.description = isnull(@description, table.description)</code> but this does not allow us to work with several operators.</li>
  <li>use the <code>exec('Statement')</code> in a Proc. This way we can build the query dynamically but the query is full of quotes, which is boring to debug and modify, not sure about the performance.</li>
  <li>Dynamic Statements in the code, but this way we miss the procedure performance.</li>
  </ul>
  
  <p>How an expert usually do? What is the best approach?</p>