コード例 #1
0
        /// <summary>
        /// This method prepares this control to be shown to the user.
        /// </summary>
        /// <param name="sqlServersArg"></param>
        /// <param name="textBoxArg"></param>
        internal void Setup(TextBox textBoxArg)
        {
            // Set SelectionTextBox
            this.SelectionTextBox = textBoxArg;

            // Load sql Servers To ListBox
            SQLSMOHelper.GetSQLServers(this.ServersListBox);
        }
コード例 #2
0
        /// <summary>
        /// This method browses for databases.
        /// </summary>
        private void BrowseDatabases()
        {
            try
            {
                // 7.17.2019: Clear the list before adding again else it adds twice I found out today
                // funny this control has been here for 12 years or more.
                this.DatabasesComboBox.Items.Clear();

                // locals
                string serverName = this.ServerTextBox.Text.ToString();

                // if the parent form exists
                if (this.ParentForm != null)
                {
                    // turn on the hourglass
                    this.ParentForm.Cursor = Cursors.WaitCursor;
                }

                // Get Databases
                SQLSMOHelper.GetDatabases(serverName, this.DatabasesComboBox);
            }
            catch (Exception error)
            {
                // for debugging only or show a message if you want
                string err = error.ToString();
            }
            finally
            {
                // if the parent form exists
                if (this.ParentForm != null)
                {
                    // turn hourglass off
                    this.ParentForm.Cursor = Cursors.Default;
                }
            }
        }