private void btnTestConnection_Click(object sender, EventArgs e) { cDatabaseHelper db = new cDatabaseHelper(lbServers.SelectedItem.ToString(), chkServerUseIntegratedSecurity.Checked, txtServerUser.Text, txtServerPassword.Text, "master"); if (db.TestConnection()) { btnTestConnection.Text = "Connection OK"; btnTestConnection.ForeColor = Color.Green; } else { btnTestConnection.Text = "no connection"; btnTestConnection.ForeColor = Color.Red; } }
private void btnGetDefaultLogDir_Click(object sender, EventArgs e) { if (lbServers.SelectedIndex == -1) { MessageBox.Show("No server selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { cDatabaseHelper db = new cDatabaseHelper(lbServers.SelectedItem.ToString(), chkServerUseIntegratedSecurity.Checked, txtServerUser.Text, txtServerPassword.Text, "master"); txtDefaultLogDir.Text = db.GetDefaultLogdir(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private DataTable GetDatabaseNames(string sServer, bool bIntegrated, string sUsername, string sPassword) { cDatabaseHelper db = new cDatabaseHelper(sServer, bIntegrated, sUsername, sPassword, "master"); return(db.GetDatabases()); }