What#39;s better: DataSet or DataReader?(哪个更好:DataSet 还是 DataReader?)
问题描述
我刚刚看到了这个话题:Datatable vs Dataset但这并没有解决我的疑问.. 让我更好地解释一下,我正在与数据库进行连接,需要在 GridView 中显示结果.(我之前在使用 VB6 时使用了 RecordSet,DataSet 与它非常相似,因此使用 DataSet 更容易.)然后一个人告诉我 DataSet 不是最好的方法..
I just saw this topic: Datatable vs Dataset but it didn't solve my doubt .. Let me explain better, I was doing connection with database and needed to show the results in a GridView. (I used RecordSet when I worked with VB6 while ago and DataSet is pretty similar to it so was much easier to use DataSet.) Then a guy told me DataSet wasn't the best method to do ..
那么,我应该学习" DataReader 还是继续使用 DataSet ?数据表?有什么优点/缺点?
So, should I 'learn' DataReader or keep using DataSet ? DataTable ? What are the pros/cons ?
推荐答案
本质上就是:桶还是软管哪个更好?"
That is essentially: "which is better: a bucket or a hose?"
一个DataSet
就是这里的桶;它允许您携带一组断开连接的数据并使用它 - 但您将承担携带存储桶的成本(因此最好将其保持在您喜欢的大小).
A DataSet
is the bucket here; it allows you to carry around a disconnected set of data and work with it - but you will incur the cost of carrying the bucket (so best to keep it to a size you are comfortable with).
数据阅读器是软管:它提供单向/一次性访问数据,因为它飞过您;您不必一次携带所有可用的水,但需要将其连接到水龙头/数据库.
A data-reader is the hose: it provides one-way/once-only access to data as it flies past you; you don't have to carry all of the available water at once, but it needs to be connected to the tap/database.
就像你可以用软管填充桶一样,你可以用数据读取器填充 DataSet
.
And in the same way that you can fill a bucket with a hose, you can fill the DataSet
with the data-reader.
我想说的是,他们做不同的事情......
The point I'm trying to make is that they do different things...
我个人并不经常使用 DataSet
- 但有些人喜欢它们.但是,我确实使用数据读取器进行 BLOB 访问等.
I don't personally use DataSet
very often - but some people love them. I do, however, make use of data-readers for BLOB access etc.
这篇关于哪个更好:DataSet 还是 DataReader?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:哪个更好:DataSet 还是 DataReader?
基础教程推荐
- rabbitmq 的 REST API 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01