vendredi 26 octobre 2018

C# if condition is working correctly but else is not working?

here i was trying to match user id password with my databse. the if part is working correctly but else is not working in browser. the code is below:

SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ITD_ClientConnectionString"].ConnectionString); connection.Open(); string checku = "select count(*) from UserRG where Pan = '" + txtid.Text + "' AND Pass='"+txtpasslog.Text+"' ";

    SqlCommand cdm = new SqlCommand(checku, connection);
    int temp = Convert.ToInt32(cdm.ExecuteScalar().ToString());
    if (temp == 1)
    {
        Response.Write("<script>alert('hurry ! welcome user')</script>");

    }
    else { Response.Write("<script>alert('password doesn't match')</script>"); }

Aucun commentaire:

Enregistrer un commentaire