コード例 #1
0
ファイル: SQLBateau.cs プロジェクト: trollgun0/Atlantik
        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);
        }
コード例 #2
0
 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();
 }
コード例 #3
0
 public string GetLibelleType()
 {
     return(SQLType.GetSQLTypeByNotypeAndLettrecategorie(FormAtlantik.GetMySqlConnection(), notype, lettrecategorie).GetLibelle());
 }