private void btnOk_Click(object sender, EventArgs e) { if (!ValidateInput()) return; this.Cursor = Cursors.WaitCursor; try { NewSqlServer.DatabaseType = "SQL2000"; NewSqlServer.ServerName = txtServer.Text; NewSqlServer.ConnectionString = GetConnectionString(); if (cmbDatabase.SelectedIndex <= 0) NewSqlServer.DatabaseName = ""; else NewSqlServer.DatabaseName = cmbDatabase.SelectedItem.ToString(); string ret = ConfigCtrl.EditServer(NewSqlServer); if (ret != CGConstants.STATUS_SUCCESS) { MessageBox.Show(ret, CGConstants.MSG_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { this.Cursor = Cursors.Default; } }