Ado.net (1) at a school, and ado.net at a school

Source: Internet
Author: User

Ado.net (1) at a school, and ado.net at a school

The ado.net eleven group is an object-oriented class library used to interact with data sources. Data sources can be databases, text files, excel tables, or XML files. In simple terms, ado.net interacts with different data sources (add, delete, modify, and query.

Ado.net allows users to interact with different types of data sources, but it does not complete the corresponding work like this, because different data sources use different protocols, different data sources must adopt the corresponding protocol. Some data sources use the ODBC protocol, and some data sources use the OLEDB protocol. . Net. The following is a detailed description of the content.

First, let's take a look at how ADO of kiyou vb interacts with databases.

1. What is ODBC?

ODBC is a common international database access standard.

2. What is an ODBC data source?

ODBC data source is the ODBC configuration and management tool on the computer. With this tool, you can customize ODBC to obtain data.

Vb and database connection Process Analysis

 

1. Create a DSN name for the vbprogram.

2 ODBC Data Source resolution DSN name

3 Data Source resolution database server name

4. The database server verifies the user name and password in the DSN.

 

So how does ado.net interact with databases?

 

The class that contains the ado.net object model is displayed. We divide the object model into two types. When the objects on the left are connected, these objects communicate directly with the database to manage connections and transactions, it also retrieves data from the database and submits changes to the database. The objects on the right are non-connection objects, allowing users to process data offline.

Analysis on the connection process between ado.net and the database

1. Define the connection string

2. Define command objects

3. Create a data read object

4. Read query results

Through comparison, we can find that the interactive connection between ado.net and ADO is very different from that between databases. For more information, see my next blog.


Which database is ADONET more suitable for accessing?

Neither
The answer is as predicted by the landlord-SQL Server. At the time of development, ADO. NET has made improvements internally to access the SQL Server. SQL Server with the same data volume is 75% faster than other databases.
---- Of course, I cannot test '''this data was told by a Microsoft VIP a long time ago''

C # how to change the value of ADOnet to query data and update one of the values?

SqlConnect conn = new SqlConnect ("connection string ");
SqlCommand cmd = new SqlCommand (SQL, conn );
SqlDataReader dr = cmd. ExecuteReader ();
While (dr. read ())
{
Obtain the ID of the record to be modified.
}
Dr. close ();

// Modify
SqlCommand cmd = new SqlCommand (SQL, conn );
Cmd. ExecuteNonQuery ();

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.