Ado. Net of five main objects

Source: Internet
Author: User

Ado. Net of five main objects

Connection : The main is to open the connection between the program and the database. It is not possible to get data from the database without using the Connection object to open the database. The difference between close and dispose is that close can be open,dispose later.

command: can be used primarily to issue some directives , for example, you can release , and call stored procedure , and so on in the database. This object is .

dataadapter: mostly perform data transfer between the source and dataset  , which can through the command  object and The data obtained is placed in the dataset  object . This object is on the Command object and provides many features that mate with dataset .

dataset: This object can be treated as a staging area (Cache), You can keep the data queried from the database and even display the entire database, and the dataset is put it in memory . The ability to dataset  is not just store multiple table  , but also through the DataAdapter object to obtain some such as the primary key data table structure, And you can record the association between the data tables. The dataset  object can be said to be a heavyweight object in the ado.net  object, which has no ability to communicate with the data source on the DataAdapter object, which means that we use the DataAdapter object as a dataset A bridge between the   object and the data source. The dataset contains several datatable , Datatabletable contains several .

datareader: When we only need sequential read data You can use the datareader  object when no other action is required. The DataReader object is just Once a stroke of data from the data source is read sequentially , which is present in the database server, and not loaded into the program's memory at once, The data for the current row can only be read (via a cursor), and the data is read-only and is not allowed for other operations. Because datareader  restricts reading only one stroke at a time, and is only read-only, it save resources and be efficient . The use of datareader  objects in addition to good efficiency, because not all the data back, it can reduce the load of the network.

ADO uses the Connection object to connect to the database, executes the SQL statement using the Command or DataAdapter object , and returns the result of the execution to the DataReader or DataAdapter , and then manipulate the data results using the obtained DataReader or DataAdapter objects.

Ado. Net of five main objects

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.