private async void btnTestConn_Click(object sender, EventArgs e) { try { ValidateNullOrEmptyOrWhiteSpace(new[] { txtServer.Text }); var response = await Operator.TestConnection(txtServer.Text, txtUsername.Text, txtPassword.Text, initDb: cmbDatabaseList.SelectedText, useWindowsAuth: cbWindowsAuth.Checked); MessageBox.Show(response.IsSuccess ? "OK" : response.Message, "Test Connection", MessageBoxButtons.OK, response.IsSuccess ? MessageBoxIcon.Information : MessageBoxIcon.Error); if (response.IsSuccess) { txtSQL.Enabled = true; txtResult.Enabled = true; cmbDatabaseList.Enabled = true; SqlOperator = new Operator(txtServer.Text, txtUsername.Text, txtPassword.Text, string.Empty, useWindowsAuth: cbWindowsAuth.Checked); LoadDatabaseList(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Blow Up!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmbDatabaseList_SelectedIndexChanged(object sender, EventArgs e) { SqlOperator = new Operator(txtServer.Text, txtUsername.Text, txtPassword.Text, initDb: (string)cmbDatabaseList.SelectedValue, useWindowsAuth: cbWindowsAuth.Checked); }