Application notes for Scott Mitchell's ASP. NET 2.0 data tutorial (updated in 12.1)

Source: Internet
Author: User
Tags manual writing
Currently, the data set development mode and three-layer structure are used in the project.
Whether it is Layer 3 or not, the biggest advantage of using the data source control is:
1. I used to need multi-table join queries. Many of them can be used now. The data source control will automatically help you solve this problem.) Is it easy and pleasant?
For example, table A has three foreign keys: id1, Id2, and ID3. You only need to convert the three fields into a template, and then select the appropriate control to bind it to the three data source controls. OK. You will not worry about the rest.

2. secondly, the objdatasource in the data source control is indeed easy to use. Other data source controls are too simple or dedicated (sitemap). Only with the combination of three layers can the power of the data source control be fully realized. It can be written manually. I haven't met what objds cannot do yet. However, you need to change your mind. Implementation and manual writingCodeIt is indeed not the same. I now have one page of code. In the past, someone else used more than 1 K lines in the background of the project. Now I only used less than 400 lines. It cannot be said that objds still has advantages in some aspects.

3. in addition, when creating an adapter, pay attention to whether the generated data type is consistent with that of the database. In particular, the char (1) type is generally set to byte. If the code is correct, an error occurs, this problem often occurs. It will be okay to modify it.

4. A little idle and inconvenient. Today, I paid a weekly discount for dynamic queries with multiple conditions. For example, where C = @ C and B = @ B and D = @ D, where B, C, and D can be empty, and the tutorial method is useless. After studying it, either set filterexpression in the objds attribute or find a way to generate the adapter. The former is not easy to implement because it may be left empty. The other method does not support the SELECT statement. The specific method should be to create a stored procedure first, and then select an existing query in the new adapter. It is best to write the query of update and other operations together. In this way, you can use it smoothly.

 

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.