循环将数据集分成多个表 [英] Break a dataset into multiple table by loop

查看:113
本文介绍了循环将数据集分成多个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个1480576行的数据集,我想按循环将其分成16个表.有人可以帮助我吗?

I have a dataset of 1480576 row,i want to break it in 16 tables by loop.Anyone can help me?

推荐答案

YourDataTable.Select()

给您一个Datarows数组.
如果您按以下方式使用LINQ;

gives you an array of Datarows.
If you use LINQ as below;

myDataTable.Select(x => x).Take(100).ToEnumerable();


给您前100个DataRows和


gives you the first 100 DataRows and

myDataTable.Select(x => x).Skip(100).Take(100).ToEnumerable();


接下来的100个.

希望这会有所帮助:)

Jas


for the next 100.

Hope this helps :)

Jas


好,奇怪的问题.分享的信息不多.

由于您询问如何将数据集分为16个表,因此需要循环16次才能从数据集中获取92536条记录.获取它们并将它们存储在单独的表中.
Well, weird question. Not much of an info shared.

Since you asked on how to break a dataset into 16 tables, you would need to loop 16 times to get 92536 records from the dataset. Get them and store them in a separate table.
for(int i=0; i<16 ; i++)
{ 
  // Create a datatable here: table[i]
  for(int j=0; j<92536; j++)
   {
      //Get data for row number [i*92536+j] of large dataset
      // insert these data in the table[i]
   }
}



试试吧!



Try!


这篇关于循环将数据集分成多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆