Guest User

Untitled

a guest
Jan 30th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. {
  2. OleDbConnection con = new OleDbConnection(@ "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=.MSAccessTestDB.accdb");
  3.  
  4. private void button1_Click(object sender, EventArgs e) {
  5. con.Open();
  6.  
  7. OleDbDataAdapter sda = new OleDbDataAdapter("SELECT * FROM LOGIN where username='" + textBox1.Text + "' and password='" + textBox2.Text + "'", con);
  8. DataTable dt = new DataTable();
  9. sda.Fill(dt);
  10. if (dt.Rows.Count == 1) {
  11. this.Hide();
  12. Form2 ss = new Form2();
  13. ss.Show();
  14. } else {
  15. MessageBox.Show("Invalid username/Password");
  16. }
  17.  
  18. con.Close();
  19. }
  20. }
Add Comment
Please, Sign In to add comment