ADO.NET overview
Connection object
Disconnected object
Connection
TRANSACTION
DataAdapter
Command
Parameter
DataReader
DataSet
Datarable
DataView
DataRow
Datacolumn
Constraint
DataRelation
One,
.NET
Data provider
The .NET Framework provides a data provider: SQL Client .NET Data Provider and OLE DB .NET DATA Provider. The former is designed for SQL Server7 and later versions of the database, which allows communication with various data storage through the OLE DB provider. No matter which way you use, the code written is very similar.
Second, the object classification overview
1, connected object
I, Connection object:
Indicates the connection between the data source. The type, location, and other properties of the data source can be specified by a variety of different attributes of the Connection object, which can be used to establish a connection or disconnect with the database. The Connection object functions as a channel, other objects such as DataAdapter and Command objects communicate with databases.
II, Command object:
Indicates the query of the database, the call to the stored procedure or to return a direct request to the specific table content. You can use the Command object to perform any query operations on the database.
III, DataReader object:
DataReder is used to retrieve and check the rows returned by the query with the fastest data. You can use the DataReader object to check the results of the query, check one line, when moving to the next line, the content of the previous line will be given up. DataReader does not support update operations, and the data returned by DataReader is read-only. Since the DataReader object supports the minimum set, it is very fast, and it is lightweight.
IV, Transaction object:
The Connection object has a begintransaction method that can be used to create Transaction objects. This object can be used to submit or cancel the changes to the database in the survival of the Transaction object.
V, Parameter object:
To use a parameterized Command object, you can create a Parameter object for each parameter in the query and add them to the paramters collection of the Command object. ADO.NET's Parameter object discloses some properties and methods, which can be used to define the data types and values of the parameters.
VI, DataAdapter object:
The DataAPter object acts as a bridge between the database and the ADO.NET object model interrupts the connected object. The DataAdapter object fills tables in the DataSet object, and can read the cache changes and submit them to the database.
2, disconnect the object
I, DATATABLE object:
The DataTable object allows you to view data through a collection of rows and columns. With the Fill method of the DataAdapter object, you can store the results of the query in the DataTable. Once the data is read from the database, it is stored in the DataTable object, and the connection between the data and the server is broken.
The DataTable class contains a collection of other disconnected objects. For example: DATAROW, DATACOLUMN, CONSTRAINTS, etc.
II, Datacolumn object:
Each DataTable has a columns collection that is the container of the Datacolumn object. The Datacolumn object stores information about the column structure.
III, CONSTRAINT object:
The Constraint object exists in the Constraints collection of the DataTable object, you can create a constraint object to ensure that the values in a column or multiple columns are only unique in DataTable. IV, DataRow object:
Want to access the actual value stored in the DataTable object, you can use the object's ROWS collection that contains a set of DATAROW objects. DataTable allows all data rows to access through DataRows. The DataRow object is also the starting point for the update.
V, DataSet object:
You can treat DataSet objects as containers of some DataTable objects. DataSet objects There are also some properties that can be written to files, memory addresses, or read the object; you can save only the contents of the DataSet object or only the structure of the DataSet object, or both can be saved.
VI, DataRelation object:
The DataSet class defines a realtion property, which is a collection of DataRelelation objects that can use the DataRelelation object to indicate the relationship between different DataTable objects in the DataSet.
DataRelelation objects have also introduced some properties to enhance the integrity of references.
VII, DataView object:
Once the result of the query in the DataTable object is obtained, you can use the DataView object to view the data in different ways. You can use multiple DataView objects to view the same DataTable at the same time.
3, strong type DataSet object
Strong type DataSet can help simplify the process of establishing data access applications. Strong Type Dataset is a class in Visual Studio, and Visual Studio is established, making all tables and column information through its properties. Strong Type DataSet objects also provide some custom methods for properties such as creating new rows.