public static int GetLastInsertId() { int lastInsertId = -1; MySqlConnection mySqlConnection = new MySqlConnection(FormAtlantik.GetMySqlConnection().ConnectionString); try { mySqlConnection.Open(); MySqlCommand mySqlCommand = new MySqlCommand("SELECT LAST_INSERT_ID(`nobateau`) FROM `bateau`", mySqlConnection); using (MySqlDataReader reader = mySqlCommand.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { lastInsertId = reader.GetInt16(0); } } } mySqlConnection.Close(); } finally { if (mySqlConnection.State.Equals(ConnectionState.Open)) { mySqlConnection.Close(); } } return(lastInsertId); }
public SQLLiaison(int noliaison, int noport_depart, int noport_arrivee, double distance) { this.noliaison = noliaison; this.noport_depart = noport_depart; this.noport_arrivee = noport_arrivee; this.distance = distance; mySqlConnection = FormAtlantik.GetMySqlConnection(); }
public string GetLibelleType() { return(SQLType.GetSQLTypeByNotypeAndLettrecategorie(FormAtlantik.GetMySqlConnection(), notype, lettrecategorie).GetLibelle()); }