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

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

问题描述

哪个会更快.

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:

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

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