private void btn_OK_Click(object sender, EventArgs e)
        {
            if (rb_Sql.Checked)
            {
                // if the address field is blank, dont do anything and alert the user
                if (tb_address.Text == "")
                {
                    MessageBox.Show("No Address Specified. Specify an address.");
                    this.DialogResult = DialogResult.None;
                    return;
                }

                // if the database field is blank, dont do anything and alert the user
                if (tb_database.Text == "")
                {
                    MessageBox.Show("No Database Specified. Specify a Database.");
                    this.DialogResult = DialogResult.None;
                    return;
                }

                // if the timeout field is blank, dont do anything and alert the user
                if (tb_timeout.Text == "")
                {
                    MessageBox.Show("No Timeout Specified. Specify a Timeout value.");
                    this.DialogResult = DialogResult.None;
                    return;
                }
            }
            else
            {
                if (tb_ConnectionString.Text == "")
                {
                    MessageBox.Show("No Connection String Specified. Specify a connection string.");
                    this.DialogResult = DialogResult.None;
                    return;
                }
            }

            try
            {
                String error;
                bool   bSuccess = false;

                if (rb_Sql.Checked)
                {
                    using (ADOConnection Conn = new ADOConnection(null, tb_address.Text, tb_database.Text, tb_username.Text, tb_password.Text))
                    {
                        bSuccess = Conn.TestConnection(out error);
                        if (bSuccess)
                        {
                            m_ConnectionString = Conn.ConnectionString;
                        }
                    }
                }
                else
                {
                    using (ADOConnection Conn = new ADOConnection(tb_ConnectionString.Text))
                    {
                        bSuccess = Conn.TestConnection(out error);
                        if (bSuccess)
                        {
                            m_ConnectionString = tb_ConnectionString.Text;
                        }
                    }
                }

                if (!bSuccess)
                {
                    this.DialogResult = DialogResult.None;
                    MessageBox.Show(error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.DialogResult = DialogResult.None;
                return;
            }
        }
        private void btn_testconn_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.None;

            if (rb_Sql.Checked)
            {
                if (tb_address.Text == "")
                {
                    MessageBox.Show("No Address Specified. Specify an address.");
                    return;
                }

                if (tb_database.Text == "")
                {
                    MessageBox.Show("No Database Specified. Specify a Database.");
                    return;
                }

                if (tb_timeout.Text == "")
                {
                    MessageBox.Show("No Timeout Specified. Specify a Timeout value.");
                    return;
                }
            }
            else
            {
                if (tb_ConnectionString.Text == "")
                {
                    MessageBox.Show("No Connection String Specified. Specify a connection string.");
                    return;
                }
            }

            try
            {
                string error;

                if (rb_Sql.Checked)
                {
                    using (ADOConnection Conn = new ADOConnection(null, tb_address.Text, tb_database.Text, tb_username.Text, tb_password.Text))
                    {
                        if (Conn.TestConnection(out error))
                        {
                            MessageBox.Show("Connection to " + tb_address.Text + "\\" + tb_database.Text + " was successful.");
                        }
                        else
                        {
                            MessageBox.Show("Connection to " + tb_address.Text + "\\" + tb_database.Text + " failed. " + error);
                        }
                    }
                }
                else
                {
                    using (ADOConnection Conn = new ADOConnection(tb_ConnectionString.Text))
                    {
                        if (Conn.TestConnection(out error))
                        {
                            MessageBox.Show("Connection to " + tb_ConnectionString.Text + " was successful.");
                        }
                        else
                        {
                            MessageBox.Show("Connection to " + tb_ConnectionString.Text + " failed. " + error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in ConnectionDialog.TestConnection." + ex.Message);
                return;
            }
        }