ADO.NET in five main target

1, Connection : mainly the connection between open programs and databases. Do not use open database connection object, it is unable to obtain data from the database.

        Close and Dispose difference, Close later can Open , Dispose after it unusable.

 

2, the Command : mainly be used to issue some instructions to the database, for example, may be issued for a database query, add, modify, delete data, instruction, and invoking the existence of the database stored procedures.

    This object is architecture Connection on the object, i.e. Command objects are connected to the data transmission source.

 

. 3, the DataAdapter : is the data source and the mainDataSetimplementation of data transfer between it permeableCommandissued after a command object, and the acquired data intoDataSetobject.

    This object is architecture in Command on the object, and provides many with the DataSet function to use.

 

4, the DataSet : this object can be seen as a temporary storage area (Cache), can be queried from the database to the data retention, or even out of the entire database can be displayed,the DataSetis placed in memory.

       DataSet ability not only can store a plurality of Table it can also be transmitted through DataAdapter obtain some of the data structures such as a primary key table like object, and can record the association between data tables.

       DataSet objects can be said ADO.NET heavyweight object , the object architectureDataAdapteron the object itself does not have the ability to communicate and the data source; that is to say we willDataAdapterobjects asDataSetto transfer data between objects and data sources bridge.

       DataSet comprising a plurality of the DataTable , DataTableTable comprising a plurality of the DataRow .

 

. 5, DataReader : when we only need to read the data without the need for additional sequential operations, may be usedDataReaderobject. DataReaderobject is simply a sum of the downward sequential read data in the data source,

    These data are present in the database server , rather than a one-time program loaded into memory, and can read the data of the current line (vernier) , and these data are read-only , and does not allow for other operations.

    Because the DataReader read data when only limits the sum of each reading, and can only be read-only, so use them not only save resources but also a very good efficiency. Use DataReader objects in addition to better efficiency, since not all the returned data, it is possible to reduce the load on the network.

       ADO.NET using the Connection object to connect to the database, using the Command or DataAdapter to perform object SQL statement, and returns the result to the DataReader or DataAdapter, and then use the acquired DataReader or DataAdapter object operation result data.

 

Guess you like

Origin www.cnblogs.com/xiaohan170208/p/11277712.html