Consolidate basic knowledge and write your own sqlhelper class step by step.
This topic is a brief introduction to ADO. net. msdn has provided a detailed introduction to this topic. I will summarize it with my own understanding.
1. Ado. Net Definition
Introduction:In today's era of rich data and information, databases are used in the computer field to store information and access information. However, there are many database types, such as SQL Server, Oracle, access, and MySQL. Therefore, how can we use a unified data access programming model to operate data in different databases more efficiently and conveniently? At this time, powerful Ms provides developers with the basis.. NET platform Data Access programming model ADO.. net.
Msdn definition:Ado. Net is a group of. NET FrameworkProgramClass that exposes data access services. The ADO. Net class is located in system. Data. dll and integrated with the XML class in system. xml. dll. ADO. net provides consistent access to data sources such as SQL Server and XML and data sources exposed through OLE DB and ODBC. Users of shared data can use ADO.. Net connects to these data sources and can retrieve, process, and update the data contained in them. The above definition is fully written.
Personally, ADO. NET is actually a class library that can add, delete, modify, and query data in different databases.
2. Use ADO. net in the connection environment and non-connection Environment
Ado. Net allows the client and database environments, including the connection environment and the non-connection environment.
(1) The Connection environment means that the user is always connected to the data source in this environment.
Advantages: 1. Data is more real-time than other environments. 2. synchronization problems are easy to control.
Disadvantages: 1. You must maintain a persistent connection and occupy the connection resources. 2. poor scalability.
Procedure:
The core classes used in the connection environment include xxxconnection, xxxcommand, xxxdatareader, and xxxdataadapter. xxx indicates the prefix of different data provider class names, such as SQL and oledb.
(2) A non-connection environment means that the user can independently store the retrieved data in a container during the initial connection. When the independent data changes, the user can re-connect to the data source, to merge the data.
Advantages: 1. do not occupy connection resources. 2. high scalability.
Disadvantages: 1. Data is not real-time. 2. data concurrency and synchronization must be solved.
Procedure:
In a non-connection environment, use the dataset class to fill the data.
(3) illustration:
3.Ado. Net Object Model
4.Ado. Net Structure
A core element of the ADO. net structure is the. NET data provider ). Including:
(1) The connection object provides a connection to the data source.
(2) commandCommandObjects can access database commands used to return data, modify data, run stored procedures, and send or retrieve parameter information.
(3) The datareader object provides fast, read-only data streams from the data source.
(4) The dataadapter object provides a bridge between the DataSet object and the data source,DataadapterUseCommandThe object executes SQL commands in the data sourceDatasetLoad the data andDatasetData changes are coordinated back to the data source.
Dataset is the core component of the non-connection (disconnection) structure of ADO. Net:
Ado. netDatasetIt is specially designed for data access independent from any data source. Therefore, it can be used for a variety of different data sources, for XML data, or for managing local data of applications. dataset contains a collection of one or more datatable objects consisting of rows and columns of data, and also primary key, foreign key, constraint, and relation information about the data in the datatable objects. "> dataset contains a set of one or more datatable objects, these objects are composed of data rows and data columns and related datatable object.
Author: forevernome
Source: http://www.cnblogs.com/ForEvErNoME/
You are welcome to repost or share it, but be sure to declare it Article Source. If the article is helpful to you, I hope you can Recommendation Or Follow