0 ,ArticleIntroduction
Analysis of this ArticleAdo. netIs applicableAdo. netDevelopers who have a certain understanding. This is a basic template used to draw inferences from each other, divergent thinking, and sort out ideas, rather than a comprehensive detailed introduction, without sticking to details or in-depth analysis, and focusing only on the most common key points.
BeginnerAdo. netDevelopers can also draw pictures and tigers.Visual StudioThe template can be imitated to make other applications.
1 , ADO. net Features
Low coupling (the mechanism for providing disconnected data can reduce the coupling between different layers );
XMLEncoding (multiple different data sources can be integrated in a common representation );
HTTPCommunication (simple transmission, which can penetrate the firewall for flexible deployment)
2 , ADO. net Structure
It consists of the left and right parts. Data supplyProgramThe interface has four implementation classes. The data provider interacts with the database.DataadapterContains fourCommandObject, which isDatasetProvide data, whileDatasetToXMLTo facilitate interaction with other components.
3 , ADO. net Object call relationship
As shown in, from bottom to top, firstConnectionObject To obtain the link to the database, and thenSQLCommands and specificConnectionObject ConstructionCommandObject orDataadapterObject. Essentially, at this timeDataadapterThe object constructor generates its own four attributes, which correspond to fourCommandObject. Then you can fill inDatasetOr passDatareaderThe data is read.
The namespace and class prefix corresponding to the four implementation classes of the data provider interface:
namespace |
class prefix |
system. data. sqlclient |
SQL |
system. data. oledb |
oledb |
system. data. ODBC |
odbc |
system. data. oracleclient |
Oracle |