コード例 #1
0
ファイル: DBSelectionForm.cs プロジェクト: shtspk/raskroy
        private void addButton_Click(object sender, EventArgs e)
        {
            ExistingDatabaseForm form = new ExistingDatabaseForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                SqlConnectionStringBuilder bldr = new SqlConnectionStringBuilder();
                bldr.DataSource         = form.serverTextBox.Text;
                bldr.InitialCatalog     = form.dbNameTextBox.Text;
                bldr.IntegratedSecurity = form.windows_auth_cb.Checked;
                if (form.sql_auth_cb.Checked)
                {
                    bldr.UserID   = form.username_tb.Text;
                    bldr.Password = form.password_tb.Text;
                }
                bldr.ConnectTimeout = 5;
                DBManager.Instance.AddDatabase(bldr.ConnectionString);
                //Properties.Settings.Default.Bases.Add(bldr.ToString());
                UpdateDatabasesListBox();
            }
        }
コード例 #2
0
		private void addButton_Click(object sender, EventArgs e)
		{
            ExistingDatabaseForm form = new ExistingDatabaseForm();
            if (form.ShowDialog(this) == DialogResult.OK)
            {
                SqlConnectionStringBuilder bldr = new SqlConnectionStringBuilder();
                bldr.DataSource = form.serverTextBox.Text;
                bldr.InitialCatalog = form.dbNameTextBox.Text;
                bldr.IntegratedSecurity = form.windows_auth_cb.Checked;
                if (form.sql_auth_cb.Checked)
                {
                    bldr.UserID = form.username_tb.Text;
                    bldr.Password = form.password_tb.Text;
                }
                bldr.ConnectTimeout = 5;
                DBManager.Instance.AddDatabase(bldr.ConnectionString);
                //Properties.Settings.Default.Bases.Add(bldr.ToString());
                UpdateDatabasesListBox();
            }
        }