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.