Exemplo n.º 1
0
        public void fillDataConnections()
        {
            SavedSettingslistBox.ClearSelected();

            while (SavedSettingslistBox.Items.Count > 0)
            {
                SavedSettingslistBox.Items.RemoveAt(0);
            }
            //READ CONFIG FILE AND LOAD CONNECTION NAMES!
            System.Configuration.Configuration config =
                ConfigurationManager.OpenExeConfiguration
                    (ConfigurationUserLevel.None) as Configuration;
            CustomSection customSection = new CustomSection();

            customSection = config.GetSection("DataConnections") as CustomSection;


            //MessageBox.Show(customSection.provider);

            //QS_swapIDdropDown.Items.Clear();

            //while (QS_swapIDdropDown.Items.Count > 0)
            //    QS_swapIDdropDown.Items.RemoveAt(0);

            //RibbonDropDownItem fstItem = this.Factory.CreateRibbonDropDownItem();
            //fstItem.Label = "Select Swap Name";
            //QS_swapIDdropDown.Items.Add(fstItem);

            //while (Rdr.Read())
            //{
            //    RibbonDropDownItem rbnItem = this.Factory.CreateRibbonDropDownItem();
            //    rbnItem.Label = Rdr.GetValue(0).ToString();
            //    QS_swapIDdropDown.Items.Add(rbnItem);
            //}
        }
Exemplo n.º 2
0
        static void checkConfigurationFile()
        {
            try
            {
                CustomSection customSection = new CustomSection();

                System.Configuration.Configuration config =
                    ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

                if (config.Sections["DataConnectionsBTG"] == null)
                {
                    customSection.ConnectionName = "Default";
                    customSection.provider       = "mySQL";
                    customSection.UserID         = "Setup";
                    config.Sections.Add("DataConnectionsBTG", customSection);
                }

                ConnectionStringSettings connStrSettings = new ConnectionStringSettings();

                config.Save(ConfigurationSaveMode.Full);
            }
            catch (ConfigurationErrorsException err)
            {
                MessageBox.Show("CreateConfigFile: {0}", err.ToString());
            }
        }