开发者

How can I add lots of rows to a DataTable quickly?

I'm adding >100,000 rows开发者_StackOverflow社区 from a DataRow[] to a DataTable, and this is taking a significant amount of time (upwards of 1 second). Is there a way of quickly adding these rows to the table all at once?

EDIT: I'm currently generating all the data in object arrays and using table.Rows.Add(rowDataArray)


if I remember well there are some methods to enable/disable validation on either datatable or dataset classes. I used in the past when loading a whole dataset from xml file and disabling validation before loading has improved loading times drastically. This might help.


According to my knowledge there is one bulk copy function available if you are talking about saving multiple records in database in one go.

Refer this link: http://www.codeproject.com/KB/database/SqlBulkCopy.aspxenter link description here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜