title: MSSQL query in C#, Geting part of WHERE clause from a string
body: <p>I am using following code: </p>
  
  <pre><code>string str = "ID = 15";
  
  using (SqlCommand cmd = new SqlCommand("SELECT * " + 
                                         "FROM Cutomer" + 
                                         " Where (Status='Umbruch') and '"+str+"' " , con))
  </code></pre>
  
  <p>I am getting this error: </p>
  
  <pre><code>near 'ID = 15' is a non boolean expression specified in a context where a condition is expected. 
  </code></pre>
  
  <p>I know I can use the above code like this:</p>
  
  <pre><code>int id = 15; 
  
  using (SqlCommand cmd = new SqlCommand("SELECT * " + 
                                         "FROM Cutomer" + 
                                         " Where (Status='Umbruch') and (ID='"+str+"')" , con))
  </code></pre>
  
  <p>It works fine like this but I want to use it as mentioned in first code above. Because the number of IDs is not fixed they can be 2,3 or more. Just for simplicity I put my code here like this. </p>