Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MySQL Connection For C#
- try
- {
- string myConnection = "datasource=db4free.net;Port=3306;username=username;password=password;database=database";
- MySqlConnection MyConn = new MySqlConnection(myConnection);
- MySqlCommand SelectCommand = new MySqlCommand("SELECT * From Public WHERE Username='" + this.UsernameTextBox.Text + "' AND Password='" + this.PasswordTextBox.Text + "' ;", MyConn); //+ "' AND HWID='" + "PUBLIC" + "';");
- MySqlDataReader myReader;
- MyConn.Open();
- myReader = SelectCommand.ExecuteReader();
- int count = 0;
- while (myReader.Read())
- {
- count = count + 1; //checks for duplicate users
- }
- if (count == 1)
- {
- MessageBox.Show("LOG ME THE FUCK IN NAQQUAA I PAID");
- }
- else if (count > 1)
- {
- MessageBox.Show("Duplicate Username and password... Access denied");
- }
- else
- {
- MessageBox.Show("Username/password is NOT Correct... Please try again");
- }
- MyConn.Close();
- }
- catch (Exception ex)
- {
- MessageBox.Show("SHIT..." + Environment.NewLine + ex.Message);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement