Sourav Kumar Das

Sourav Kumar Das

  • 686
  • 2.4k
  • 68.1k

Error while Conversion.

Sep 17 2018 2:17 AM
Getting Error in this Coloured Line....
 
"An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code
Additional information: Conversion failed when converting the varchar value 'sourav@gmail.com' to data type int."
 
public bool IsUserExist(string Emailid)
{
bool flag = false;
SqlConnection connection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConString"].ConnectionString);
connection.Open();
SqlCommand command = new SqlCommand("select count(*) from Register where UserID = '" + Emailid + "'", connection);
flag = Convert.ToBoolean(command.ExecuteScalar());
connection.Close();
return flag;
}
 
If there's a solution please send me the answers....

Brought to you by:

Answers (1)