Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button1_Click(object sender, EventArgs e)
- {
- //GET USER INFO
- string username = textUsername.Text;
- string password = textPassword.Text;
- //IF USER FOUND
- try
- {
- //SELECT FROM DB
- string sql = "SELECT username AND password FROM users WHERE username ='" + username + "' AND password = '" + password + "'";
- MySqlDataAdapter da = new MySqlDataAdapter(sql, sCon.Con);
- DataSet Ds = new DataSet();
- Ds.Reset();
- da.Fill(Ds, sql);
- //DataTable dtStock = new DataTable();
- //sql.Fill(dtStock);
- //if (0 == dtStock.Rows.Count)
- //{
- // MessageBox.Show("Not logged in"); ;
- //}else
- //{
- MessageBox.Show("Logged in");
- //}
- }
- catch (Exception ex)
- {
- MessageBox.Show("Error, try again");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement