数据集和数据读取器 [英] Data set and Data Reader

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

问题描述

哪一个最适合在C#的Web应用程序中使用?

DataSet或DataReader

Which one is best to use in web application of C#?
Either DataSet or DataReader

推荐答案

DataReader是快进的只有读者,其中DataTable和DataSet代表一个或多个内存数据表。



这取决于您在网络应用中的需求。如果必须缓存数据结果。使用DataTable。
DataReader is a fast-forward only reader, where DataTable and DataSet represents one or more table of in-memory data.

It depends on your need in your web app. If you have to cache your data result. The use DataTable.


从这里开始 - Google search - dataset vs datareader [ ^ ]。
Start here - Google search - dataset vs datareader[^].


没有什么比最好了。这完全取决于您的要求。如果您只需要显示某些内容,则没有理由选择DataSet。但是如果你还需要进行更新和插入,你可以使用DataSet。



BTW DataAdapter使用DataReader来填充DataSet尽管它有点无关紧要。



OffTopic:没有任何名为C#.Net。
There is nothing like best. It all depends on what your requirements are. If all you need is to display something, there is no reason to go for a DataSet. But if you need to do updates and inserts as well, you may use DataSet.

BTW DataAdapter uses DataReader to populate the DataSet although it is bit irrelevant.

OffTopic: There is nothing called C#.Net.


这篇关于数据集和数据读取器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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