Example #1
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            frmNewDatabase newDatabase = new frmNewDatabase(cbxProviderType.SelectedItem as IDatabaseProvider, this.txtDatabaseAddress.Text);

            if (newDatabase.ShowDialog() == DialogResult.OK)
            {
                if (newDatabase.DatabaseConfigurator != cbxProviderType.SelectedItem)
                {
                    cbxProviderType.SelectedItem = newDatabase.DatabaseConfigurator;
                    txtDatabaseAddress.Text      = "";
                    txtUserName.Text             = "";
                    cbxDatabase.Text             = "";
                }

                if (txtDatabaseAddress.Text == "")
                {
                    txtDatabaseAddress.Text = newDatabase.Server;
                }
                if (txtUserName.Text == "")
                {
                    txtUserName.Text = newDatabase.Server;
                }
                if (cbxDatabase.Text == "")
                {
                    cbxDatabase.Text = newDatabase.DatabaseName;
                }
            }
        }
Example #2
0
        /// <summary>
        /// Create a new database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnNew_Click(object sender, EventArgs e)
        {
            frmNewDatabase newDatabase = new frmNewDatabase(this.ConnectionString);

            if (newDatabase.ShowDialog() == DialogResult.OK)
            {
                if (newDatabase.ConnectionString.Provider != this.ConnectionString.Provider)
                {
                    this.ConnectionString = newDatabase.ConnectionString;
                }
            }
        }