title: Best practice to build dynamic SQL queries
body: <p>I am looking for some tips and tricks how to build dynamic queries. I am having an application which lets the user search 10 fields in the database table. Depending on which fields in the UI are filled with a value the query should search in an additional field in the DB.</p>
  
  <p>Currently I am trying to build the query using StringBuilder and adding the where clause but I really don't like this and I am wondering if there is a better way to do this, for example with LINQ if possible.</p>
  
  <p>Maybe someone can bring up ideas or better some example code. Thanks and have a nice day!</p>