The difference between a sqldataread and a dataset

Source: Internet
Author: User

Selection of Sqldataread and datasets

Sqldataread Benefits: Read data very quickly. If you do not need to do a lot of processing for the returned data, it is recommended to use SqlDataReader, which has a much better performance than Datset. Disadvantage: Do not close the connection to the database until the data is read

(SqlDataReader reading data is fast forward.) The SqlDataReader class provides a way to read a data-only stream retrieved from a SQL Server database. It uses SQL Server's native network data transfer format to read data directly from a database connection.

DataReader need to be explicit close in time. Timely release of the connection to the data. )

The dataset reads the data out and is slow to exist in memory. Disadvantage: high memory footprint. If you need to do a lot of processing of the returned data with a dataset better can reduce the connection to the database operation. Benefits: Connect to the database only once

* In general, read a large amount of data, do not do a lot of processing of the return data with SqlDataReader. It is more appropriate to datset the return data. The choice of SqlDataReader and dataset depends on the implementation of the program function.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.