i'm new to this field.Now i'm trying to create login form with MySql as DB.I've following error.
string constr = "server=localhost;user name=root;password=pwd;database=contacts";
MySqlConnection con = new MySqlConnection(constr);
query = "SELECT Count(*) FROM contacts WHERE username='" + nametxt.Text + "' AND password='" + pwdtxt.Text + "'";
MySqlCommand com = new MySqlCommand(query, con);
con.Open();
string result = string.Empty;
int aa = Convert.ToInt32(com.ExecuteScalar().ToString());
con.Close();
if(aa==0)
{
lblerr.Text = "Invalid username or password";
}
else
{
Response.Redirect("detailadd.aspx");
}