Beispiel #1
0
        private void serverNameCoboBox_DropDown(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                SqlConnectionStringBuilder connectionBuilder = new SqlConnectionStringBuilder();

                connectionBuilder.DataSource         = serverNameCoboBox.Text;
                connectionBuilder.IntegratedSecurity = windowsAuthenticationRadioButton.Checked;
                connectionBuilder.UserID             = userNameTextBox.Text;
                connectionBuilder.Password           = passwordTextBox.Text;

                serverDatabaseComboBox.DataSource = SqlUtilities.GetDatabaseList(connectionBuilder.ConnectionString);
            }
            catch (Exception exp)
            {
                serverDatabaseComboBox.DataSource = null;
                serverDatabaseComboBox.Items.Clear();
                Messager.ShowError(this, exp);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Beispiel #2
0
        void SqlServerConfiguration_Load(object sender, EventArgs e)
        {
            if (_DesignMode)
            {
                return;
            }

            this.Cursor = Cursors.WaitCursor;
            string local = string.Empty;

            try
            {
                if (string.IsNullOrEmpty(serverDatabaseComboBox.Text))
                {
                    serverDatabaseComboBox.Text = "LEADTOOLSJobProcessorDB";
                }

                if (!_DesignMode)
                {
                    try
                    {
                        string currentServer = serverNameCoboBox.Text;

                        try
                        {
                            serverNameCoboBox.DataSource = SqlUtilities.GetServerList(out local);

                            if (!String.IsNullOrEmpty(local))
                            {
                                serverNameCoboBox.Text = local;
                            }
                        }
                        catch (Exception)
                        {
                            Messager.ShowInformation(this,
                                                     "The application can't enumerate the SQL Servers located in your network because \"Microsoft SQL Server 2008 Management Objects (SMO)\" is not installed.\n\n" +
                                                     "You can manually type the SQL Server name in the server name field or install Microsoft SMO from the Microsoft site:\n" +
                                                     @"http://www.microsoft.com/downloadS/details.aspx?familyid=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&displaylang=en");
                        }

                        if (!string.IsNullOrEmpty(currentServer))
                        {
                            serverNameCoboBox.Text = currentServer;
                        }
                    }
                    catch (Exception exp)
                    {
                        Messager.ShowError(this, exp);
                    }
                }
            }
            catch (Exception)
            {
                serverNameCoboBox.DataSource = local;

                Messager.ShowInformation(this,
                                         "The application can't enumerate the SQL Servers located in your network because \"Microsoft SQL Server 2008 Management Objects (SMO)\" is not installed.\n\n" +
                                         "You can manually type the SQL Server name in the server name field or install Microsoft SMO from the Microsoft site:\n" +
                                         @"http://www.microsoft.com/downloadS/details.aspx?familyid=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&displaylang=en");

                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }