protected void btnlogin_Click(object sender, EventArgs e)
{
string strcon = ConfigurationManager.ConnectionStrings["pranjalConnectionString"].ToString();
SqlConnection con = new SqlConnection(strcon);
con.Open();
string email = txtEmailid.Text.Trim();
string passwd = txtPassword.Text.Trim();
string sql = "Select Email,password from reg_vidyatbl where Email='" + txtEmailid+ "'and password='" + txtPassword + "'";
SqlCommand cmd = new SqlCommand(sql, con);
cmd.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet dt = new DataSet();
da.Fill(dt);
if (dt.Tables[0].Rows.Count > 0)
{
Response.Redirect("home.aspx");
}
else
{
lblerrorlog.Text = "invalid usernane or password";
}
this is my login code but it is not working properly,im directly getting error msg.control is not going insid the if codition.let me know if i ha made any mistake