Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- string myConnection = "datasource=localhost;port=3306;username=root;password=easteagle";
- MySqlConnection myConn = new MySqlConnection(myConnection);
- myConn.Open();
- MySqlCommand SelectCommand = new MySqlCommand("select ussername,password from `database`.employeeinfo where ussername ='" + this.username_txt.Text+ "' and password ='" + this.password_txt.Text + "' ;" ,myConn);
- MySqlDataReader myReader = SelectCommand.ExecuteReader();
- int count = 0;
- while (myReader.Read())
- {
- count++;
- }
- if (count == 1)
- {
- MessageBox.Show("is good");
- }
- else if (count >1)
- {
- MessageBox.Show("duplicate password");
- }
- else
- {
- MessageBox.Show("not good");
- }
- myConn.Close();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement