저는 MVC를 처음 접했고 sqlserver에 대한 등록 양식 링크를 만들었습니다. 나는이 오류 그러나 : 나는 바로 여기 내 오류 얻을MVC C# SqlException
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;
}
:
An expression of non-boolean type specified in a context where a condition is expected, near 'ID
여기 내 코드입니다
flag = Convert.ToBoolean(command.ExecuteScalar());
내가 뭔가 잘못하고 있어요 알아 내 어디 스테이트 넷,하지만 그게 뭔지 확실하지 않다면 : ( 도와 주시면 고맙겠습니다. 감사합니다!
'command.ExecuteScalar()'의 값은 무엇을 반환합니까? 코드를 디버그 했습니까? 항상 매개 변수가있는 쿼리를 사용해야합니다. 이러한 종류의 문자열 연결은 SQL 주입 공격에 개방적입니다. –
SQL 주입 사람? –