I'm pretty new to MVC and Have created a registeration form link to my sqlserver. However I get this error:
An expression of non-boolean type specified in a context where a condition is expected, near 'ID
and here is my code:
public bool IsUserExist(string emailid)
{
bool flag = false;
SqlConnection connection = new SqlConnection("Data Source=HOMESERV;Initial Catalog=JSO;Integrated Security=True;MultipleActiveResultSets=True");
connection.Open();
SqlCommand command = new SqlCommand("select * from EMPLOYEE where EMP ID='" + EMP_ID + "'", connection);
flag = Convert.ToBoolean(command.ExecuteScalar());
connection.Close();
return flag;
}
I get my error right here:
flag = Convert.ToBoolean(command.ExecuteScalar());
I know I'm doing something wrong in my where statemnet, but not sure what is that :( I would appreciate if you would help me. Thank you!