填充数据表时,数据读取器是否比数据集更快? [英] Is datareader quicker than dataset when populating a datatable?
问题描述
哪个会更快.
1) 循环数据读取器并创建基于填充数据表的自定义行和列
1) Looping a datareader and creating a custom rows and columns based populated datatable
2) 或者创建一个 dataAdapter 对象并只(.Fill)一个数据表.
2) Or creating a dataAdapter object and just (.Fill)ing a datatable.
动态创建数据表后,数据读取器的性能是否仍然适用?
Does the performance of a datareader still hold true upon dynamic creation of a datatable?
推荐答案
DataAdapter 在幕后使用 DataReader,因此您的体验可能相同.
The DataAdapter uses a DataReader under the hood so your experience would likely be the same.
DataAdapter 的好处是您可以删除大量需要维护的代码.
The benefit of the DataAdapter is you cut out a lot of code that would need maintenance.
这场辩论有点宗教问题,所以一定要环顾四周,决定什么最适合你的情况:
This debate is a bit of a religious issue so definitely look around and decide what works best for your situation:
- http://blogs.msdn.com/memilavi/archive/2008/02/18/datareader-vs-dataset-the-real-question.aspx
- http://xcskiwinn.org/community/博客/panmanphil/archive/2004/09/21/281.aspx
- http://weblogs.asp.net/joelevi/archive/2008/02/12/asp-net-datareader-vs-dataset.aspx
- http://weblogs.asp.net/dreilly/存档/2003/09/27/29411.aspx
这篇关于填充数据表时,数据读取器是否比数据集更快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!