private void btnTestConn_Click(object sender, EventArgs e) { m_ConnectionTested = false; try { //checks for blank fields if (txtDatabaseName.Text == "") { MessageBox.Show("Please enter a database name. \nNo Database Name"); } else if (txtSQLUID.Text == "") { MessageBox.Show("Please enter a User Name.\nNo Username"); } else if (txtSQLPWD.Text == "") { MessageBox.Show("Please enter a Password.\nNo Password"); } else { m_ConnSettings = new clsConnection(txtSQLAddress.Text, txtDatabaseName.Text, 1, false, txtSQLUID.Text, txtSQLPWD.Text); //string e_ServerAddress, string e_DBName, int e_Timeout, bool e_Trusted, string e_UserID , string e_Password) if (m_ConnSettings.TestDBConnection()) { //'Conection was completed without exceptions MessageBox.Show("Connection Successful", "ODM Data Loader", MessageBoxButtons.OK); //Me.Cursor = Windows.Forms.Cursors.Default this.Cursor = Cursors.Default; m_ConnectionTested = true; //Check for Known Errors } else { m_ConnectionTested = false; MessageBox.Show("Cannot connect to the specified server.\nPlease change the server name or use a different login."); } } } catch (Exception ex) { MessageBox.Show("Error Testing the Database Connection \n" + ex.Message); } }