public Ocurrence(FileInfo fi, string word, string url) { this._word = word; if (fi == null && url.Length != 0) { this._URL = url; } else if (fi != null && url.Length == 0) { this._URL = fi.DirectoryName + "\\" + fi.Name; this._SimpleURL = this._URL.Replace("\\", "\\\\"); } this._numberOfOccurence = 1; string requestWord = "SELECT idWord from t_word where `worWord`='" + _word + "';"; string requestFile = "SELECT idFile from t_file where `filURL`='" + _SimpleURL + "';"; Connexion conec = new Connexion(); if (conec.OpenConnection() == true) { //create command and assign the query and connection from the constructor MySqlCommand cmd = new MySqlCommand(requestFile, conec.Connection); //Execute command MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { idFile = reader[0].ToString(); } //close connection conec.CloseConnection(); } else { Console.WriteLine("Il y a un problème avec la connexion"); } Connexion conec2 = new Connexion(); if (conec2.OpenConnection() == true) { //create command and assign the query and connection from the constructor MySqlCommand cmd = new MySqlCommand(requestWord, conec2.Connection); //Execute command MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { idWord = reader[0].ToString(); } //close connection conec2.CloseConnection(); } else { Console.WriteLine("Il y a un problème avec la connexion"); } }