Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. CREATE PROC LoginUser
  2. @username nvarchar(50),
  3. @password nvarchar(50)
  4. AS
  5. BEGIN
  6. IF EXISTS(SELECT * FROM [JDKdb].[dbo].[Accounts] WHERE Username=@username AND Password=@password)
  7. BEGIN
  8. RETURN 1
  9. END
  10. ELSE
  11. BEGIN
  12. RETURN 0
  13. END
  14. END
  15.  
  16. private void btnLogin_Click(object sender, EventArgs e)
  17. {
  18. string access = "";
  19. access = db.LoginUser(txtUsername.Text, txtPassword.Text).ToString();
  20. if (access == "1")
  21. {
  22. this.Hide();
  23. FrmDashboard dash = new FrmDashboard(txtUsername.Text);
  24. dash.ShowDialog();
  25. }
  26. else
  27. {
  28. MessageBox.Show("Invalid account" + access);
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement