Three Layers of handwriting-add, delete, modify, and query

Source: Internet
Author: User

Overall

Start with the topic

First, there must be a model. How can I perform operations without objects?

+ View code

Then there will be a sqlhelper (otherwise the database will be exhausted)

View code

Then write the data access layer (DAL ):

View code

In the write business logic layer (BLL ):

View code

Then we need to write a list page to display the data. Otherwise, how can we add, delete, and modify the data? (It seems like nonsense !)

Front-end:

View code

Background:

View code

Write and add it first! Otherwise, all the hard-coded data will be deleted!

Here, you can write the added content to the List page. It's too lazy to go back and try again.

Front-end:

View code

Background:

View code

This should be done by deleting a general handler!

View code

The last step is to modify it. This is a bit interesting.

Front-end:

View code

Background:

View code

In fact, modification and addition can completely share a page, or a div. Here I will write them separately. It's easy!

Don't forget to configure webconfig!

View code

In this way, we have achieved success!

Three Layers of handwriting-add, delete, modify, and query

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.