Objectdatasouce introduction Part1: it has the freedom of ADO. Net and the convenience of datasouce.

Source: Internet
Author: User

Most of the books introduced on the market generally refer to datacontrol such as sqldatasouce, gridview, detailview, and so on. Of course these are very convenient and can be used at leastProgramCodeTo delete the query. However, in fact, it is not as good as you think during project development. You will not always be able to process new modification and deletion queries for a single data table. What should I do if I want to process more than two data tables ??

In ASP. NET 2.0, an objectdatasouce is added, which allows us to write data through our own programs or developed objects when processing data.

Let's look at the following:

1. sqldatasouce:

Sqldatasouce uses four command settings: Select, insert, update, and delete to access data.

2. Use objectdatasouce

Objectdatasouce is processed by the specified category and the method (function/Sub) written in the category. Select must return the result, the returned results can be written in the following ways: datareader, dataset, able, davaview, and collection objects (object set. gridview1.datasouce = XXXX indicates the type that can be passed in. Other insert, update, and delete operations must be used together to transmit the data to be maintained and access data through ADO. net.

 

3. Use objectdatasouce with Business Object (*. dll/class)

You can extract the data access and some commercial logic, write them into some commercial objects, and then write a category to use these commercial objects to combine them with objectdatasouce.

Here we can understand that using objectdatasouce, you can write your own program for data access. The ability to write programs according to their own needs, so that the system can be more flexible applications. You can also use the datasouce mechanism to integrate with data control items (such as gridview, detailview, and formview. This allows you to reduce programs and make applications more convenient. It can be said that it has the freedom of ADO. Net and the convenience of datasouce ].

As for how to write the 2.3 method, we willArticle.

Pai_^

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.