samedi 25 avril 2015

Contains Method doesnt work


 String emailID = Session["New"].ToString();
        string usertype = returnQuery("select userType from Registration where email = '" + lblEmail.Text + "'");
        if (usertype.Contains("Student"))
        {         
            Response.Redirect("Profile.aspx?email=" + emailID.ToString());
        }
        else if (usertype.Contains("Company"))
        { 
            Response.Redirect("CompanyProfile.aspx?email=" + emailID.ToString());
        }
        else if(usertype.Contains("Admin"))
        {
            Response.Redirect("AdminProfile.aspx?email=" + emailID.ToString());
        }
        else
            Response.Write("Error");

I want to compare the UserType if it is Student I want to redirect him to srudent profile etc. But it always gets to the last else statement and Writes an Error the returnQuery method works well because it returns Student value.


Aucun commentaire:

Enregistrer un commentaire