In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "what are the ADO.NET 2.0 data access objects?". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the ADO.NET 2.0 data access objects?"
ADO.NET: a redesigned data access model on the. Net platform. ADO.NET 2.0 provides a series of access forms to all kinds of data, and provides corresponding classes, which provide properties and methods to interact with the corresponding data. Programmers can easily access all kinds of data through these attributes and methods, such as database, XML and so on.
In ADO.NET 2.0, the SQL data provider uses a unified SQL data access model to support data access to various databases using SQL statements. For example, Oracle, SQL Server, DB2, Access, etc. ADO.NET features: support connectionless access to data and reduce the number of active connections to the database.
Second, ADO.NET data access object
ADO.NET provides a variety of object models, typical of which are:
◆ SqlConnection object
◆ SqlCommand object
◆ SqlDataReader object
◆ SqlDataAdapter object
◆ SqlParameter object
◆ SqlTransaction object
These objects provide a variety of different access to Sql Server data sources, all classified under the System.Data.SqlClient namespace.
2.1 SqlConnection object:
ADO.NET uses SqlConnection objects to connect to SQL Server. But specify a connection string in the SqlConnection object.
2.2 SqlCommand object
In ADO.NET, there are two ways to manipulate a database:
(1) in a connectionless way.
(2) keep the connection.
Either way, you can pass commands for database operations through the methods provided by ADO.NET 2.0 objects and return the results of the command execution. The general steps for operating a database while maintaining a connection are:
1) create an instance of SqlConnection
2) create an instance of SqlCommand
3) Open the connection
4) execute the command
5) close the connection.
SADO.NET 2.0 objects provide several ways to complete operations on a database. Commonly used are:
1. ExecuteNonQuery
This method executes the results of the SQL statement, but does not return the table data executed by the command, only the number of rows affected by the operation.
2. ExecuteReader
This method provides a way to quickly read data in the database only forward and sequentially. According to the provided SELECT statement, this method returns a SqlDataReader object that can be read sequentially, and the programmer can use the Read method to cycle through the contents of each field (column) in each record.
3. ExecuteScaler ()
This method is used to execute a SELECT query, and the returned result is a value, such as using the number of records in the ADO.NET 2.0 table or summing with the sum function.
At this point, I believe you have a deeper understanding of "what ADO.NET 2.0 data access objects are". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.