예제 #1
0
        public DynamicTable ExecuteDynamicTable(SqlStatement sql)
        {
            var table = new DynamicTable();

            ExecuteDataReader(sql, dr => {
                while (dr.Read())
                {
                    if (table.NeedInit)
                    {
                        for (int i = 0; i < dr.FieldCount; i++)
                        {
                            table.AddKey(dr.GetName(i), i);
                        }
                        table.NeedInit = false;
                    }
                    var row  = table.NewRow();
                    var cols = new object[dr.FieldCount];
                    dr.GetValues(cols);
                    row.AppendMemberRange(cols);
                }
            });
            return(table);
        }
 public DynamicTable ExecuteDynamicTable(SqlStatement sql)
 {
     var table = new DynamicTable();
     ExecuteDataReader(sql, dr =>
     {
         while (dr.Read())
         {
             if (table.NeedInit)
             {
                 for (int i = 0; i < dr.FieldCount; i++)
                 {
                     table.AddKey(dr.GetName(i), i);
                 }
                 table.NeedInit = false;
             }
             var row = table.NewRow();
             var cols = new object[dr.FieldCount];
             dr.GetValues(cols);
             row.AppendMemberRange(cols);
         }
     });
     return table;
 }