Guest User

Untitled

a guest
Dec 14th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. lb_Fail.Visible = false;
  4. }
  5.  
  6. protected void btn_Login_Click(object sender, EventArgs e)
  7.  
  8. {
  9. // connecion to the database
  10. SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Fasthosts_MMConnectionString"].ConnectionString);
  11.  
  12. SqlDataAdapter sda = new SqlDataAdapter("SELECT COUNT(*) FROM Fasthosts_Registration_MM WHERE username='" + tb_UsernameLogin.Text + "' AND password='" + tb_PasswordLogin.Text + "'", conn);
  13. /* in above line the program is selecting the whole data from table and the matching it with the user name and password provided by user. */
  14. DataTable dt = new DataTable(); //this is creating a virtual table
  15. sda.Fill(dt);
  16. if (dt.Rows[0][0].ToString() == "1")
  17. {
  18.  
  19. Response.Redirect("Domains.aspx");
  20.  
  21. }
  22. else
  23. {
  24. lb_Fail.Text = ("Incorrect login details");
  25. lb_Fail.Visible = true;
  26. }
  27. }
Add Comment
Please, Sign In to add comment