Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | None | 0 0
  1. private void button1_Click(object sender, EventArgs e)
  2.         {
  3.             //GET USER INFO
  4.             string username = textUsername.Text;
  5.  
  6.             string password = textPassword.Text;
  7.  
  8.             //IF USER FOUND
  9.             try
  10.             {
  11.  
  12.                 //SELECT FROM DB
  13.                 string sql = "SELECT username AND password FROM users WHERE username ='" + username + "' AND password = '" + password + "'";
  14.                 MySqlDataAdapter da = new MySqlDataAdapter(sql, sCon.Con);
  15.                 DataSet Ds = new DataSet();
  16.                 Ds.Reset();
  17.                 da.Fill(Ds, sql);
  18.  
  19.                 //DataTable dtStock = new DataTable();
  20.  
  21.                 //sql.Fill(dtStock);
  22.  
  23.                 //if (0 == dtStock.Rows.Count)
  24.                 //{
  25.                    // MessageBox.Show("Not logged in"); ;
  26.                 //}else
  27.                 //{
  28.                    MessageBox.Show("Logged in");
  29.                 //}
  30.  
  31.             }
  32.             catch (Exception ex)
  33.             {
  34.                 MessageBox.Show("Error, try again");
  35.             }
  36.  
  37.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement