public List <string> GetHostNames(string sqlServer, string database) { try { this.Text = "Add Host(s)"; lblListType.Text = "Hosts"; BizTalkGroupBase bizTalkGroup = new BizTalkGroupBase(); bizTalkGroup.SqlServer = sqlServer; bizTalkGroup.MgmtDBName = database; foreach (string host in bizTalkGroup.GetHostList()) { lvwItems.Items.Add(new ListViewItem(host)); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (ShowDialog() == DialogResult.OK) { List <string> list = new List <string>(); foreach (ListViewItem lvi in lvwItems.SelectedItems) { list.Add(lvi.Text); } return(list); } else { return(new List <string>()); } }
private void cmdTestDB_Click(object sender, EventArgs e) { BizTalkGroupBase bizTalkGroup = new BizTalkGroupBase(); bizTalkGroup.SqlServer = txtSQLServer.Text; bizTalkGroup.MgmtDBName = txtDatabase.Text; if (!bizTalkGroup.TestConnection()) { MessageBox.Show(bizTalkGroup.LastError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Success", "Connection test", MessageBoxButtons.OK, MessageBoxIcon.Information); } }