public static Boolean ValidateUser(string struser, string strpass)
{
// Establish connection information
SqlConnection conn_string = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Data Source=137.145.169.3;Initial Catalog=SICI4266;Persist Security Info=True;User ID=SICI4266G3;Password=*******"].ConnectionString);
// Establish SQL command
SqlCommand sql_comm = new SqlCommand("SELECT count(userID) FROM HIEPA.HIEPA_USERS where UserName = @usuario and UserPassword = @contrasena ; ", conn_string);
// Provide Parameter values
sql_comm.Parameters.AddWithValue("@usuario", struser);
sql_comm.Parameters.AddWithValue("@contrasena", strpass);
// Open the connection
conn_string.Open();
// Execute the SQL command and assign the resulting value to an integer variable
Int32 intUserCount = Convert.ToInt32(sql_comm.ExecuteScalar());
// Close the connection
conn_string.Close();
// Evaluate the integer variable content; greater than cero is a valid combination
if (intUserCount == 1)
{
return true;
}
else
{
return false;
}
}
can somebody tell me why this error is prompted?