DataReader&数据集。 [英] DataReader & DataSet.

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

问题描述

为什么我们将数据读取器称为面向连接和数据集断开的体系结构,尽管我们只是一次访问数据库并将值存储在数据读取器或数据集中。之后,我们正在执行任务。因此,我们不需要任何连接。请用一个例子非常巧妙地解释。



我们可以在数据阅读器和数据集中存储多少条记录(例如10,0000或10万),在这种情况下我们选择数据读取器而不是数据集,反之亦然?



DataReader和DataSet的用途是什么?

解决方案

datareader不存储任何内容,它只是从调用Read方法的数据存储区中检索下一条记录。连接和查询保持打开状态,同时逐个读取每个结果。使用数据集读取所有数据并将其存储在数据集中,不再需要连接。


或者您首先阅读此内容: DataSet与DataReader [ ^ ]

DataSet与SqlDataReader [ ^ ]

http:// www.techrepublic.com/article/which-is-best-for-you-datareader-or-dataset/ [ ^ ]

http://stackoverflow.com/questions/1083193/whats-better-dataset-or-datareader [ ^ ]



-KR

Why we call data reader as connection oriented and data set disconnected architecture though we are hitting once to the database and took the values then store in either data reader or data set. After that, we are performing the task. So for this we do not need any connection. Please explain very neatly with an example.

how many records(e.g 10,0000 or 1 lakh) we can store in data reader as well as dataset and in which case we go for data reader rather than data set and vice-versa ?

What is the use of DataReader & DataSet ?

解决方案

The datareader doesn't store anything, it simply retrieves the next record from the datastore where the Read method is called. The connection and query remains open while each result is read one at a time. With a dataset all the data is read and stored in the dataset and the connection is no longer needed.


Or how about you read this first: DataSet vs. DataReader[^]
DataSet Vs SqlDataReader[^]
http://www.techrepublic.com/article/which-is-best-for-you-datareader-or-dataset/[^]
http://stackoverflow.com/questions/1083193/whats-better-dataset-or-datareader[^]

-KR


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

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