public TableScriptData[] GeneratePopulateScripts() { try { ArrayList dataList = new ArrayList(); string selectSql; StringBuilder sb = new StringBuilder(); this.dbConn = GetConnection(this.data.DatabaseName, this.data.SQLServerName, this.data.UserId, this.data.Password); for (int i = 0; i < this.tableList.Length; i++) { DataTable table = GetTableValues(this.tableList[i], out selectSql); string[] columnNames = GetColumnNames(table); sb.Length = 0; sb.Append(String.Format(this.scriptHeader, new object[] { DateTime.Now.ToString(), this.tableList[i], selectSql })); for (int j = 0; j < table.Rows.Count; j++) { sb.Append(GenerateRowStatement(this.tableList[i], columnNames, table.Rows[j], j + 1)); } TableScriptData data = new TableScriptData(); data.TableName = this.tableList[i]; data.ValuesTable = table; data.InsertScript = sb.ToString(); data.SelectStatement = selectSql; dataList.Add(data); } TableScriptData[] arrData = new TableScriptData[dataList.Count]; dataList.CopyTo(arrData); return(arrData); } finally { this.DisconnectServer(); } }
public PopulateScriptDisplay(TableScriptData data) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); this.ScriptDataTable = data.ValuesTable; this.ScriptText = data.InsertScript; this.ScriptName = data.TableName; this.SelectStatement = data.SelectStatement; }
public virtual bool Fill(TableScriptData dataClass) { try { this.TableName = dataClass.TableName; this.ValuesTable = dataClass.ValuesTable; this.InsertScript = dataClass.InsertScript; this.SelectStatement = dataClass.SelectStatement; return(true); } catch (System.Exception ex) { throw new System.ApplicationException("Error in the Auto-Generated: TableScriptData.Fill(TableScriptData) Method", ex); } }