private void buttonLancerDB_Click(object sender, EventArgs e) { if (VerifierChamps()) { if (VerifierChampsDB()) { string connexionString = "Server = " + textBoxDBHote.Text + "; Port = " + textBoxDBPort.Text + "; Database = " + textBoxDBMonde.Text + "; Uid = " + textBoxDBUsername.Text + "; Pwd = " + textBoxDBPass.Text; // On lance la connexion au serveur MySQL MySqlConnection connection = new MySqlConnection(connexionString); try { connection.Open(); } catch (Exception mysqlEx) { MessageBox.Show("Erreur lors de la connexion à la base de données " + Environment.NewLine + mysqlEx.Message, "Erreur !"); return; } AbstractParser parser; switch (comboBoxType.SelectedIndex) { case 0: parser = new ItemParser(this, textBoxIdDebut.Text, textBoxIdFin.Text, getLocale(), connection); break; case 1: parser = new NPCParser(this, textBoxIdDebut.Text, textBoxIdFin.Text, getLocale(), connection); break; } } } }
private void buttonLancer_Click(object sender, EventArgs e) { if (VerifierChamps()) { AbstractParser parser; switch (comboBoxType.SelectedIndex) { case 0: parser = new ItemParser(this, textBoxIdDebut.Text, textBoxIdFin.Text, getLocale()); break; case 1: parser = new NPCParser(this, textBoxIdDebut.Text, textBoxIdFin.Text, getLocale()); break; } } }