Guest User

Untitled

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