Guest User

Untitled

a guest
Jun 10th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. SqlConnection database1con = new SqlConnection();
  2. database1con.ConnectionString = "Data source=LOCALHOST\\SQLEXPRESS;Initial Catalog=database1;Integrated security=true";
  3. database1con.Open();
  4. string userTEXT = textBox1.Text;
  5. string passwordTEXT = textBox2.Text;
  6. SqlCommand cmd = new SqlCommand("SELECT username,password FROM password WHERE username='" + textBox1.Text + "' and password='" + textBox2.Text + "'", database1con);
  7. SqlDataAdapter da = new SqlDataAdapter(cmd);
  8. DataTable dt = new DataTable();
  9. da.Fill(dt);
  10. if (dt.Rows.Count > 0)
  11. {
  12. Form3 f = new Form3();
  13. f.ShowDialog();
  14. database1con.Close();
  15. }
  16. else
  17. MessageBox.Show("Login failed");
Add Comment
Please, Sign In to add comment