예제 #1
0
        private void Login_Load(object sender, EventArgs e)
        {
            System_Config = Program_Configuration.GetSystem_Config();
            if (System_Config.SQL_server == null || System_Config.Database == null || System_Config.SQL_server == "" || System_Config.Database == "")
            {
                System_config system_Config = new System_config();
                system_Config.SQL_server = @"Data Source=CALIS_YII\WINCC;Initial Catalog=ComponentState;Integrated Security=True";
                system_Config.Database   = "ComponentState";
            }

            if (System_Config.SQL_server != "" && System_Config.Database != "")
            {
                comboBox1.Text = System_Config.SQL_server;
                comboBox2.Text = System_Config.Database;
            }
            DataTable dt = SQL_action.GetSQL_SeverList();

            comboBox1.Items.Clear();
            foreach (DataRow r in dt.Rows)
            {
                if (r["InstanceName"].ToString() != "")
                {
                    comboBox1.Items.Add(r["ServerName"].ToString() + "\\" + r["InstanceName"].ToString());
                }
                else
                {
                    comboBox1.Items.Add(r["ServerName"].ToString());
                }
            }
        }
예제 #2
0
 private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e)
 {
     if (data)
     {
         DataTable dt = SQL_action.GetSQL_DatabaseList(comboBox1.SelectedItem.ToString());
         comboBox2.Items.Clear();
         foreach (DataRow r in dt.Rows)
         {
             string databaseName = r["database_name"].ToString();
             comboBox2.Items.Add(databaseName);
         }
     }
 }