TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
David Smith
NA
2k
0
Exporting 4.5 million records to text file from temp datatable
May 8 2012 2:00 AM
I have 4.5 million records in a temporary
datatable
, my goal is to export data to a
text file
in chunks of records until all records are written to textfile or processing
Can someone help me write the logic to export 750,000 records at a time until all records are gone. For every 750,000 records create its own text file. Below is the logic I using below in code, can you guys help me modify logic below
DataTable dataTable = new DataTable ();
dataTable.Columns.Add(new DataColumn("UNIT", typeof(string)));
dataTable.Columns.Add(new DataColumn("SERIAL", typeof(string)));
dataTable.Columns.Add(new DataColumn("PART", typeof(string)));
SqlDataReader dr = cm.ExecuteReader();
while(dr.Read())
{
nextRow = dataTable.NewRow();
nextRow["UNIT"] = row.UNIT;
nextRow["SERIAL"] = row.SERIAL;
nextRow["PART"] = row.PART;
dataTable.Rows.Add(nextRow);
}
Reply
Answers (
1
)
Emailing From Database
System out memory exception when exporting 4.5 million records to an textfile