ADO SqlDataReader Detailed

Source: Internet
Author: User

The ADO data provider has three SQL Server data providers, OLE DB providers, and ODBC providers, respectively.

This record is a few of the knowledge points in the SQL Server provider.

①sqldatareader must be instantiated by SqlCommand call DataReader. This class is characterized by a read-only, fast access speed.

The Read method pulls the data from the data source, and only one record (read-only) is fetched per read, during which time the local DataReader does not cache the data while maintaining a connection to the database. When retrieving large amounts of data, the speed is very good. It is important to close the current database connection when Sqldatareader.read () ==false, that is, there is no matching data.

In the SqlDataReader class, there are a lot of ways to get worthwhile methods, such as GetSqlInt32 (), Getsqlvalue (), Getsqlmoney (), which provide a good performance for these systems. (can avoid unnecessary packing, unpacking operation)

SqlDataReader dataReader = command. ExecuteReader ();
if (datareader.hasrows)
{
while (Datareader.read ())
{
var a = datareader.getint32 (0);
}
}

②sqldataadapter, this class has multiple construction methods. Simply say it. There are several command forms: Selectcommand,updatecommand,insertcommand,deletecommand, which need to set the response SQL statement in order to respond to the action.

ADO SqlDataReader Detailed

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.