Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have a dataset of 1480576 row,i want to break it in 16 tables by loop.Anyone can help me?
Posted

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.
C#
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!
 
Share this answer
 
Comments
StackQ 30-Aug-12 8:29am    
can u tell me how can i save my data in excel file from dataset,in 3 sheets,if rows are 65536*3 in dataset.One thing that i don't want to define 3 sheet,if 1st sheet saved by 65536 rows,then next 65536 rows should save in 2nd sheet and so on in same excel file.plz help bcoz i m trying since 4 days to make a program by which i can save data,from dataset to excel in multiple sheet dynamically.
C#
YourDataTable.Select()
gives you an array of Datarows.
If you use LINQ as below;
C#
myDataTable.Select(x => x).Take(100).ToEnumerable();

gives you the first 100 DataRows and
C#
myDataTable.Select(x => x).Skip(100).Take(100).ToEnumerable();

for the next 100.

Hope this helps :)

Jas
 
Share this answer
 
v2
Comments
Sandeep Mewara 30-Aug-12 8:20am    
So many rows of data in memory.. I would avoid that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900