Connection Connection Object
Command object that indicates the command and stored procedure to execute!
DataReader is a forward-only, read-only data stream.
DataAdapter is a powerful adapter to support the function of adding and removing changes.
A dataset is a data-level object, which is equivalent to a table in memory or multiple tables! (The recordset is in ASP)
1 I will bring the goods over the river, and I'll Fix the bridge first (DataConnection),
2 then make a command plan, whether to transport the past (insert) items or shipped over (Select) items or destroy items (delete) and so on. (This is the command plan).
3 then use the car to transport (DataAdapter is the car),
4 then put the item in a pool (the dataset is the pool),
5 and DataReader is the bridge that the head of a camera, you can take the data of the goods photographed, pass over.
6 As for the DataGrid DataView DataList and so on is a Data View (control), is to show the data, such as the last thing I want to see is the candy in the item, then this is a DataGrid or DataView.
Connection
Establish a connection to a specific data source. The base class for all Connection objects is the DbConnection class.
Command
Executes a command against the data source. Public Parameters, and can be executed from Connection within the Transaction range.
The base class for all Command objects is the DbCommand class.
DataReader
Reads a forward-only and read-only stream of data from the data source. The base class for all DataReader objects is the DbDataReader class.
DataAdapter
Populate the dataset with the data source and resolve the update. The base class for all DataAdapter objects is the DbDataAdapter class.
Note: Novice interviews often encounter such questions: the five main objects of ADO, is the above four kinds of + datasets to be firmly remember oh. Later development is often used.
Connection object (only SqlConnection and JDBC are introduced)
Remember to open, close (back to the connection pool) when using connection connection,
It is recommended that you use using so that you do not forget to shut down and automatically disconnect even if an unhandled exception occurs.
String connectionString = "database connection string";
using (SqlConnection connection = new SqlConnection (connectionString)) {connection. Open (); .... }
ODBC comparison Trouble please refer to Microsoft Technical Documentation: http://support.microsoft.com/kb/310988 (I seldom use it)
using (odbcconnection connection = new OdbcConnection (connectionString)) {connection. Open (); .... }
Command object
Command
return value
ExecuteReader
Returns a DataReader object.
ExecuteScalar
Returns the first column of the first row of the database query.
ExecuteNonQuery
Execute the change and delete command.
ExecuteXmlReader
Returns XmlReader. Used only for SqlCommand objects.
Ado. NET five major objects in the detailed