Hi All,
could you please help me on this.
i have bulk upload data from excel sheet user is going to upload into data base.if user is upload 10k records system is getting hang/not responding
now i have to do out of 10k records insert into DB first 2000 and again next 2000(first 2000 need to remove from Dataset) like that upto ends .
please help me anybody on this.
Advanced in Thank you.
Thanks,
Narasimha

arjunPosted Jun 18, 2013, 1:37 AM
use SqlBulkCopy for bulk insert.
thanks
arjun
Sunny SharmaPosted Jun 18, 2013, 1:20 AM
I suggest you using LINQ in this context, it's beautiful.
below is a sample for you:
-----------------------------------------------------
DataTable dt = new DataTable();
// I assume dt to be filled already.
int count=0;
while (count < dt.Rows.Count)
{
var Hundred_Records = dt.Select().Skip(count).Take(100).CopyToDataTable();
foreach (DataRow dr in Hundred_Records.Rows)
{
// Manipulation goes here.
}
count+=100;
}
------------------------------------------------------------
Happy Coding :)
Please mark this as answer if it helps!
Cheers!