Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3. SqlConnection log = new SqlConnection("Data Source=MODIFIEDforStackOverflow;Initial Catalog=logininfo;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
  4.  
  5. log.Open();
  6.  
  7. string newcon=("select username from login where username='"+textBox1.Text+"' and password='"+textBox2.Text+"'");
  8.  
  9. SqlDataAdapter adp = new SqlDataAdapter(newcon, log);
  10.  
  11. DataSet ds = new DataSet();
  12.  
  13. adp.Fill(ds);
  14.  
  15. DataTable dt = ds.Tables[0];
  16.  
  17. if (dt.Rows.Count >= 1)
  18. {
  19. settext = textBox1.Text;
  20.  
  21. welcome wc = new welcome();
  22. wc.Show();
  23.  
  24. this.Hide();
  25. }else
  26. {
  27. label3.Text = "Invalid Login!";
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement