This blog introduces some classes in ADO. Net, which are not very familiar with coding. Therefore, make a summary!
Oledbconnection class: provides a data source link
Parameters |
Description |
Provider |
Specified oledb provider |
Data Source |
Specify the database server name or |
Initial catalog |
Database name used |
User ID |
ID of the registered user |
Password |
Password of the registered user |
Integrated Security |
The specified provider should call the appropriate security provider in the operating system to obtain the registration name, and then use the registration name to verify the access, usually designated as sspi |
Oledbdataadapter class: serves as a bridge between dataset and databases
1. selectcommand attribute: Derived from oledbcommand class
Attribute |
Description |
Connection |
Set oledbconnection object used to access the database |
Commandtext |
Set the SQL statement or stored procedure name used to select data |
Commandtype |
Sets how to interpret the value of the commandtext attribute, that is, to identify SQL statements and stored procedures. |
2. executenonequery method: Execute selectcommand
If an SQL statement is executed, the returned value is-1. If the stored procedure is executed, the number of affected rows is returned.
3. Fill Method: Fill in the execution result of the executenonequery method to dataset.
Syntax: Fill (dataset, string). dataset is a valid DataSet object and string is the name of the table to be mapped. If
Multiple tables. This parameter specifies the root table. That is, the table specified by the from clause in the SQL statement.
Dataset class: Save the query results to the memory of the client.
Dataview class: It is generally used to sort, filter, search, edit, and navigate data from dataset.
1. sort method: Set the columns to be sorted by the attributes and the sorting method.
2. Find method: Find matched data from dataview
Oledbcommand class: queries the database: Select, insert, update, or delete
Attribute |
Description |
Connection |
Set to an object that contains dynamic links to the database |
Command and commandtype |
Same as selectcommand attribute |
Parameters set |
It also includes the direction (parameter usage direction), parameternames attributes, and dbtype attributes (specifying the data type) |
Once again, I feel a little clearer ......