10 new features of ADO. net2.0

Source: Internet
Author: User
This article Article This section describes the latest features of ADO. net2.0 in. NET Framework 2.0. The following describes some simple examples to discuss the details of these features.

The following are new features of ADO. Net:

1. Bulk copy operation)

Copying data from one data source to another is a new feature of ADO. NET 2.0. The batch copy class provides the fastest way to migrate data from one data source to another. Each ADO. NET data provider provides a corresponding batch replication class. For example, in the SQL. NET data provider, the batch copy operation is completed by a class called sqlbulkcopy. It can read a dataset, datatable, datareader, or XML object.

2. Batch update)

If the database server supports batch update, batch update replaces several short-cycle request submission methods, which greatly improves the performance when multiple batch updates are generated to the server within a short cycle. The updatebatchsize attribute provides the number of rows to be updated in a batch of updates. This attribute value can be limited to decimal places.

3. Data Paging

Now the command object has a new execution method called executepagereader. This method has three parameters: commandbehavior, startindex, and pagesize. If you want to obtain the number of rows from 101 to 200, you can call this method to set startindex to 101 and pagesize to 100.

4. Data connection details

Now you can get more information about a connection by setting the statisticsenabled attribute of the connection to true. The connection object provides two new methods: retrievestatistics and resetstatistics. The retrievestatistics method returns a hashtable object to fill in the connection information, such as data transfer, user details, cursor details, cache information, and transaction processing.

5. dataset. remoringformat attributes

When dataset. remoringformat is set to binary, the serialization format of dataset replaces the original XML tag format with the binary format. This change can significantly improve the performance of serialization and restoration serialization operations.

6. The load and save methods of datatable

In earlier versions of ADO. net, only dataset has the load and save methods. The load method can load data from objects such as XML to a DataSet object, and save the data to a persistent storage media. Datatable now supports these two methods.

7. New Data Control

In the toolbox, you will see the new controls shown in 1-datagridview dview, dataconneand datanavigator. With these controls, you can provide the data navigation (paging) function in the data binding control.


Figure 1 data binding control

8. dbprovidersfactories class

This class provides a list of existing data providers (providers) in the current machine. Write database dependencyProgramYou can use this class and its members to find the most suitable data provider for your database.

9. Custom Data Provider)

By providing factory classes, ADO. Net can now expand and support the custom data provider function. You do not need to write a data providerCode. You can use the data provider base class and connection string to help you complete these functions.

10. datareader new execution Method

Now the command object supports more execution methods. In addition to the old executenonquery, executereader, executescaler, and executexmlreader methods, new execution methods are added: executepagereader, executeresultset, and executerow. Figure 2 shows all the execution methods supported by the command object in ADO. net2.0.


Figure 2 Command Execution Method

Summary

Ado. net2.0 provides developers with many new and improved features to improve performance and reduce the amount of code. In this article, I have discussed 10 features of ADO. net2.0. In my subsequent articles, I will continue to discuss these features in more detail.

[Note] For the first translation, please forgive me for any questions. Original English article address: http://www.c-sharpcorner.com/Code/2004/June/AdoNet2.0Features.asp

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.