Login Code:-
protected void Login_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["con"].ToString());
string sqlquery = "select count(*) from registration where email=@email and password=@password";
SqlCommand cmd = new SqlCommand(sqlquery, con);
cmd.Parameters.AddWithValue("@email", Tlogin.Text);
cmd.Parameters.AddWithValue("@password", FormsAuthentication.HashPasswordForStoringInConfigFile(Tpassword.Text, "Md5"));
con.Open();
int i = (int)cmd.ExecuteScalar();
if (i > 0)
{
Response.Write("Congrachulations! U successfully enter in profile");
}
else
{
Response.Write("Please check username or password");
}
con.Close();
}
protected void Login_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["con"].ToString());
string sqlquery = "select count(*) from registration where email=@email and password=@password";
SqlCommand cmd = new SqlCommand(sqlquery, con);
cmd.Parameters.AddWithValue("@email", Tlogin.Text);
cmd.Parameters.AddWithValue("@password", FormsAuthentication.HashPasswordForStoringInConfigFile(Tpassword.Text, "Md5"));
con.Open();
int i = (int)cmd.ExecuteScalar();
if (i > 0)
{
Response.Write("Congrachulations! U successfully enter in profile");
}
else
{
Response.Write("Please check username or password");
}
con.Close();
}
No comments:
Post a Comment