1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
string ConnexionSQL = "SERVER=sql11.freemysqlhosting.net; PORT=3306; DATABASE=sql11229992; UID=sql11229992;PWD=uTbtVndAeI;";
maConnexionSQLsrv = new MySqlConnection(ConnexionSQL);
//string query = "SELECT * FROM staff WHERE `mdp` = '" + textBox4.Text + "'";
maRequete = "SELECT * FROM staff WHERE `mdp` = @mdpjoueur";
myCommand = new MySqlCommand(maRequete, maConnexionSQLsrv);
myCommand.Parameters.Add("@mdpjoueur", textBox4.Text);
// myCommand.Parameters["@mdpjoueur"].Value = textBox4.Text;
MessageBox.Show("OK");
try
{
//Execution de la requête
MySqlDataAdapter datardr = new MySqlDataAdapter(System.Convert.ToString(myCommand), maConnexionSQLsrv);
DataTable dttable = new DataTable();
datardr.Fill(dttable);
//"INSERT INTO [article] ( [idclient],[idarticle],[prixarticle]) VALUES(@id_article, @prix_article, @nom_article)";
if (dttable.Rows.Count == 1)
{
c = new MySqlCommand("select nom from staff where mdp = @Value;", maConnexionSQLsrv); //<-------- l'érreur est ici
c.Parameters.AddWithValue("@Value", textBox4.Text);
// maRequete2 = "SELECT `nom` FROM staff WHERE `mdp` like(@mdpjoueur)";
// myCommand2 = new MySqlCommand(maRequete2, maConnexionSQLsrv);
// myCommand2.Parameters["@mdpjoueur"].Value = textBox4.Text;
try
{
//Execution de la requête
maConnexionSQLsrv.Open();
string nomstaff = (string)c.ExecuteScalar();
nomstaffmsgbox = nomstaff;
MessageBox.Show(nomstaff);
maConnexionSQLsrv.Close();
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message);
}
// string query2 = "SELECT nom FROM staff WHERE `mdp` = '" + textBox4.Text + "'";
MessageBox.Show("Bienvenue " + nomstaffmsgbox + ", les options réservées au membres du Staff sont désormais activées !", "Mode Staff Activé", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
nsComboBox1.Items.Add("Administration");
nsComboBox1.Items.Add("Évènements");
nsComboBox1.Items.Add("Sanctions du Serveur");
textBox4.Enabled = false;
nsButton2.Text = "Clé Activée !";
button2.Enabled = true;
button2.Text = "Surveillance Joueurs";
button1.Enabled = true;
button1.Text = "Membres du Staff";
nsButton2.Enabled = false;
if (nomstaff == "Havanna" || nomstaff == "privé" || nomstaff == "privé" || nomstaff == "privé" || nomstaff == "privé")
{
Class1.getData = "Autorisé";
Class1.permissionsstaff = "Autorisé";
}
}
else
{
MessageBox.Show("Erreur : Cette clé n'existe pas, merci d'inscrire une clé valide.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (MySqlException ex)
{
MessageBox.Show(ex.Message);
} |
Partager