I am using following code:
string str = "ID = 15";
using (SqlCommand cmd = new SqlCommand("SELECT * " +
"FROM Cutomer" +
" Where (Status='Umbruch') and '"+str+"' " , con))
I am getting this error:
near 'ID = 15' is a non boolean expression specified in a context where a condition is expected.
I know I can use the above code like this:
int id = 15;
using (SqlCommand cmd = new SqlCommand("SELECT * " +
"FROM Cutomer" +
" Where (Status='Umbruch') and (ID='"+str+"')" , con))
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.