在填充数据表时,datareader是否比数据集快吗? [英] Is datareader quicker than dataset when populating a datatable?

查看:145
本文介绍了在填充数据表时,datareader是否比数据集快吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



1)循环数据采集器并创建一个基于填充的数据表的自定义行和列。



在动态创建数据表时,datareader的性能仍然保持正确?

解决方案

DataAdapter在引擎盖下使用DataReader,以便您的体验可能会相同。



DataAdapter的好处是删除了大量需要维护的代码。



这场辩论有点像宗教问题肯定环顾四周,决定最适合您的情况:




Which would be quicker.

1) Looping a datareader and creating a custom rows and columns based populated datatable

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?

解决方案

The DataAdapter uses a DataReader under the hood so your experience would likely be the same.

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:

这篇关于在填充数据表时,datareader是否比数据集快吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆