private void bOK_Click(object sender, System.EventArgs e) { // Build the ConnectionProperties XML StringBuilder sb = new StringBuilder(); sb.Append("<ConnectionProperties>"); sb.AppendFormat("<DataProvider>{0}</DataProvider>", this.cbDataProvider.Text); sb.AppendFormat("<ConnectString>{0}</ConnectString>", this.tbConnection.Text.Replace("<", "<")); sb.AppendFormat("<IntegratedSecurity>{0}</IntegratedSecurity>", this.ckbIntSecurity.Checked? "true": "false"); if (this.tbPrompt.Text.Length > 0) { sb.AppendFormat("<Prompt>{0}</Prompt>", this.tbPrompt.Text.Replace("<", "<")); } sb.Append("</ConnectionProperties>"); try { DataSourceReference.Create(tbFilename.Text, sb.ToString(), tbPassword.Text); } catch (Exception ex) { MessageBox.Show(ex.Message, "Unable to create data source reference file"); return; } DialogResult = DialogResult.OK; }