コード例 #1
0
ファイル: SQLParametres.cs プロジェクト: trollgun0/Atlantik
        public static SQLParametres GetSQLParamtres(MySqlConnection mySqlConnection)
        {
            SQLParametres sqlParametres = null;

            try
            {
                mySqlConnection.Open();
                MySqlCommand mySqlCommand = new MySqlCommand("Select * From Parametres where noidentifiant = 0", mySqlConnection);
                using (MySqlDataReader reader = mySqlCommand.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            sqlParametres = new SQLParametres(reader.GetInt16(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetBoolean(5), reader.GetString(6));
                        }
                    }
                }
                mySqlConnection.Close();
            }
            finally
            {
                if (mySqlConnection.State.Equals(ConnectionState.Open))
                {
                    mySqlConnection.Close();
                }
            }

            return(sqlParametres);
        }
コード例 #2
0
        private void FormModifierLesParametresDuSite_Load(object sender, EventArgs e)
        {
            SQLParametres sqlParametres = SQLParametres.GetSQLParamtres(mySqlConnection);

            textBoxSite.Text           = sqlParametres.GetSite_pb();
            textBoxRang.Text           = sqlParametres.GetRang_pb();
            textBoxIdentifiant.Text    = sqlParametres.GetIndentifiant_pb();
            textBoxHMAC.Text           = sqlParametres.GetClehmac_pb();
            checkBoxProduction.Checked = sqlParametres.IsEnproduction();
            textBoxMel.Text            = sqlParametres.GetMelsite();
        }