Ado.Net summary

ADO.NET summary

ADO.NET is a component to access the database on the .NET platform, which is based on a technology ODBC (Open Database Connectivity) technology the way to access the database.
ADO.NET common namespace:

Namespaces Data Provider
System.Data.SqlClient Microsoft SQL Server
System.Data.Odbc ODBC
System.Data.OracleClient Oracle
System.Data.OleDb OLE DB

When using ADO.NET typically used for database operations five categories, namely

  • Connection
  • Command
  • DataReader
  • DataAdapter
  • DataSet

System.Data.SqlClient the five objects: SqlConnection, SqlCommand, SqlDataReader, SqlDataAdapter, DataSet

Connection

This class is mainly used for database operations to establish a connection and disconnection, and by that class for the current state of the database connection.

Command

This class is mainly performed on the database to add, delete, modify, and query operations.

DataReader

Such queries for reading out data from the database, but only read when reading data can not be read back forward, and can not modify the value of the class object.
When an interrupt connection to a database, the value of such objects also will be cleared.

DataAdapter类

Combined with the DataSet class, which is mainly the result of a database for delivery to the DataSet save.
DataAdapter can be seen as a bridge database with the DataSet, not only the result of the operation in the database can be transported to the DataSet, and saved to the database after the DataSet can change.

DataSet class

DataReader class and similar, are used to store the results of a database query.
The difference is that, not only the value DataSet class may be repeated a plurality of times to read, but also the value of the DataSet value changes in the database can be changed.
Further, the value DataSet class can still retain the original value in the case of a disconnected database.

memory:

Imagine a battlefield:
the database is an arsenal, Command battlefield commanders can deploy weapons; Connection is the address of the arsenal ;; DataReader from the arsenal of transportation engineering battlefield, DataAdapter is a powder keg and transport tanks in front of the battlefield, It can be two-way transmission ammunition; DataSet is temporary battlefield arsenal. This memory once it five important objects.

Published 117 original articles · won praise 17 · Views 140,000 +

Guess you like

Origin blog.csdn.net/xingkongtianyuzhao/article/details/103943727