Ejemplo n.º 1
0
 /// <summary>
 /// Builds a table of records for a given record set.
 /// </summary>
 /// <returns>
 /// The table of records.
 /// </returns>
 /// <param name='recordSet'>
 /// The record set.
 /// </param>
 public static DataTable BuildTableOfRecords(RecordSet recordSet)
 {
     var table = new DataTable();
     var values = new FieldValueTableBuildingVisitor(recordSet);
     foreach (string column in values.ColumnNames)
     {
         table.Columns.Add(column, typeof(string));
     }
     foreach (Dictionary<string, string> fieldSet in values.Rows)
     {
         DataRow row = table.NewRow();
         foreach (KeyValuePair<string, string> entry in fieldSet)
         {
             row[entry.Key] = string.Format("\"{0}\"", entry.Value.Replace("\"", "\\\""));
         }
         table.Rows.Add(row);
     }
     return table;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Builds a table of records for a given record set.
        /// </summary>
        /// <returns>
        /// The table of records.
        /// </returns>
        /// <param name='recordSet'>
        /// The record set.
        /// </param>
        public static DataTable BuildTableOfRecords(RecordSet recordSet)
        {
            var table  = new DataTable();
            var values = new FieldValueTableBuildingVisitor(recordSet);

            foreach (string column in values.ColumnNames)
            {
                table.Columns.Add(column, typeof(string));
            }
            foreach (Dictionary <string, string> fieldSet in values.Rows)
            {
                DataRow row = table.NewRow();
                foreach (KeyValuePair <string, string> entry in fieldSet)
                {
                    row[entry.Key] = string.Format("\"{0}\"", entry.Value.Replace("\"", "\\\""));
                }
                table.Rows.Add(row);
            }
            return(table);
        }