Advertisement
Guest User

Untitled

a guest
Apr 6th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. string b = Convert.ToString(UserNameComboBox.SelectedItem);
  2. SqlConnection DataFind = new SqlConnection(@"Data Source=.sqlexpress; Initial Catalog=PAYROLL MANAGEMENT SYSTEM;Integrated security=true;");
  3. DataFind.Open();
  4.  
  5. SqlCommand dmd;
  6. dmd = new SqlCommand("SELECT COUNT(*) FROM LoginDetail where( (UserName=' " + b + "') AND (Password='" + Password.Text + "' ))", DataFind);
  7. dmd.ExecuteNonQuery();
  8. Int32 count = Convert.ToInt32(dmd.ExecuteScalar());
  9.  
  10. DataFind.Close();
  11. SelectedRowNo.Text = count.ToString();
  12. if (count == 1)
  13. {
  14. Form1 s = new Form1();
  15. s.Show();
  16. }
  17. else
  18. {
  19. MessageBox.Show("Sorry You are not an authirized user");
  20. }
  21. }
  22. catch { MessageBox.Show("UserName or Password not valid");
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement