private void btn_Preview_Click(object sender, EventArgs e) { try { StringBuilder scriptBuilder = new StringBuilder(); scriptBuilder.Append("---------------------------------------Insertion Script to : [").Append(SelectedTableName()).Append("]---------------------------------------"); scriptBuilder.Append(Environment.NewLine).Append(Environment.NewLine); scriptBuilder.Append(SqlHelper.GenerateInsertionSQLScriptFromDataTable(_gridDataTable)); TextBoxControl txtControl = new TextBoxControl(); txtControl.SetText(scriptBuilder.ToString()); txtControl.Show(this); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_PreviewMultipleTable_Click(object sender, EventArgs e) { try { StringBuilder scriptBuilder = new StringBuilder(); for (int cnt = 0; cnt < lbx_MultiSelectedTable.Items.Count; cnt++) { string tableName = lbx_MultiSelectedTable.Items[cnt].ToString().Trim(); scriptBuilder.Append("---------------------------------------Insertion Script to : [").Append(tableName).Append("]---------------------------------------"); scriptBuilder.Append(Environment.NewLine).Append(Environment.NewLine); scriptBuilder.Append(GenerateScriptByTableName(tableName)); scriptBuilder.Append(Environment.NewLine).Append(Environment.NewLine); } TextBoxControl txtControl = new TextBoxControl(); txtControl.SetText(scriptBuilder.ToString()); txtControl.Show(this); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }