Voici comment j'initialise ma connexion
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 private MySqlConnection connection; // Constructeur public Manager() { this.InitConnexion(); } // Méthode pour initialiser la connexion private void InitConnexion() { // Création de la chaîne de connexion string connectionString = "SERVER=127.0.0.1; PORT=3306; DATABASE=SuiviProjet; UID=root; PASSWORD="; this.connection = new MySqlConnection(connectionString); }
Et encore une fois, non elle n'est pas nulle, elle contient bien la chaîne de connexion à ce moment là
Partager