Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myReader = SelectCommand.ExecuteReader();
- MySqlConnection conn = new MySqlConnection("secretstring")
- MySqlCommand SelectCommand = new MySqlCommand("SELECT * FROM userspassword where'" + this.loginuser.Text + "'and password'" + this.passworduser.Text, conn);
- MySqlDataReader myReader;
- conn.Open();
- //myReader = SelectCommand.ExecuteReader();
- myReader = SelectCommand.ExecuteReader();
- int count = 0;
- while (myReader.Read())
- {
- count = count + 1;
- }
- if (count == 1)
- {
- MessageBox.Show("Correct");
- Form2 pannel = new Form2();
- pannel.Show();
- Hide();
- }
- else if (count > 1)
- {
- MessageBox.Show("More then 1 user logged in");
- }
- else
- MessageBox.Show("Incorrect password or username");
- conn.Close();
- MySqlCommand SelectCommand = new MySqlCommand("SELECT * FROM userspassword where " +
- "username = '" + this.loginuser.Text + "' and password = '" +
- this.passworduser.Text +"'" , conn);
- MySqlCommand SelectCommand = new MySqlCommand("SELECT * FROM userspassword where " +
- "username = @uname and password = @pwd", conn);
- SelectCommand.Parameters.AddWithValue("@uname",this.loginuser.Text);
- SelectCommand.Parameters.AddWithValue("@pwd",this.passworduser.Text);
- myReader = SelectCommand.ExecuteReader();
- "SELECT * FROM userspassword where'" + this.loginuser.Text
- ^^^^^^^ Column name is missing..
- MySqlCommand SelectCommand = new MySqlCommand("SELECT * FROM userspassword where " + "YourColumnName = '" + this.loginuser.Text + "' and password '" + this.passworduser.Text +"'" , conn);
- MySqlCommand SelectCommand =
- new MySqlCommand("SELECT * FROM userspassword where username='"
- + this.loginuser.Text + "' and password='"
- + this.passworduser.Text +"'", conn);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement