ADO. NET Programming SQL Server

Source: Internet
Author: User

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 ......

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.