Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From Login where USERNAME ='" + txtUsername.Text + "' and PASSWORD ='" + txtPassword.Text + "'",con);
  2. DataTable dt = new DataTable();
  3. sda.Fill(dt);
  4. if (dt.Rows[0][0].ToString() == "1")
  5. {
  6. this.Hide();
  7. CTMain ss = new CTMain();
  8. ss.Show();
  9. }
  10. else
  11. {
  12. MessageBox.Show("Please check your Username and/or Password");
  13. }
  14.  
  15. private void CTMain_Load(object sender, EventArgs e)
  16.  
  17. {
  18. cbxListstores.Items.Clear();
  19. con.Open();
  20. SqlCommand scm = con.CreateCommand();
  21. scm.CommandType = CommandType.Text;
  22. scm.CommandText = "select STORENAME from Login";
  23. scm.ExecuteNonQuery();
  24. DataTable dt = new DataTable();
  25. SqlDataAdapter sda = new SqlDataAdapter(scm);
  26. sda.Fill(dt);
  27. foreach (DataRow dr in dt.Rows)
  28. {
  29. cbxListstores.Items.Add(dr["STORENAME"].ToString());
  30. cbxListstores.SelectedIndex = 0;
  31. }
  32. con.Close();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement