ado.net database access

Database access, regardless of two kinds: connection type, breakaway

A connection type: Use SqlConnectio

Access to the database and the connection process between the SqlConnection the formula is the Open (), Close ()

Data reading using SqlDataReader

Pros: take up less memory, data is read when the database has been and remains connected for a small amount of data when high efficiency.

Disadvantages: need to maintain the established database connection, if the user access to large, may lead to an abnormal connection pool, the connection complex.

Second, the breakaway: the SqlDataAdapter used (data adapter)

Advantages: i.e. before breakaway connection attributes configuration, switching the connection no longer, reducing the frequency of access to the server, connection pool does not take up too much resources, open a data set locally for storing the read data, modify when the changes do not only for the local data sets directly modify the data server.

Disadvantages: This mode is the one-time read the data in memory, so the large amount of data can be very time consuming memory

 

 

 

Guess you like

Origin www.cnblogs.com/Kai-YoungMaster/p/12424314.html