ASP analog MVC programming

Source: Internet
Author: User
Everyone knows that the most popular programming method in JAVA is the MVC model. If you do not know the concept of MVC, you can search for it online and find N more materials immediately. After PHP5 was launched, it began to use the MVC model for development. It seems that MVC is indeed very attractive!
During my development of ASP projects, I also used this JAVA development mode for reference. Although the implementation is not very good, it also made the code structure much clearer, greatly facilitating the artist to modify the program!
The following is my code. For more information, see annotations.
The main implementation of the program is the operations of the background administrator: add, delete, modify
There are two programs: adminusers_class.asp and adminusers_gl.asp.
It is equivalent to a servlet and a bean in JAVA! So we didn't fully implement MVC, just simulated it!
The adminusers_class.asp code is as follows:
<%
****************** *****************
Rem page function: Website background administrator management class
Rem @ author Cai Xiaoliang
Rem @ version 1.0
Rem @ date 2005-2-22
%>
<! -- # Include file = "conn. asp" -->
<%
'Administrator management
Class AdminUsersGl
Dim ASO
Private adminuser_name
Private adminuser_password
Private admingroup_id
Private adminuser_isshow
Private adminuser_selfconfig
Private adminuser_realname
'Constructors start
Private Sub Class_Initialize
Set ASO = Server. CreateObject ("Adodb. RecordSet ")
End Sub
'Destructor start
Private Sub Class_Terminate
Err. Clear
Set ASO = Nothing
End Sub
'Add Postmaster
Public Function AdminUsers_Add (adminuser_name, adminuser_password, admingroup_id, adminuser_realname, adminuser_selfconfig, adminuser_isshow, adminuser_language)
SQL = "select adminuser_name from ce_adminusers where adminuser_name = '" & adminuser_name &"'"
ASO. Open SQL, conn, 1, 3
If ASO. RecordCount <> 0 then
Response. Redirect ("messages. asp? Mess_name = DATA_ADD_FAILURE & back_page = adminusers_gl.asp? Action = add ")
End if
If ASO. RecordCount = 0 then
ASO. Close
SQL = "insert into ce_adminusers (adminuser_name, adminuser_password, login, adminuser_realname, login, adminuser_isshow, adminuser_language) values ('" & adminuser_name & "', '" & adminuser_password &"', "& admingroup_id &", '"& adminuser_realname &"', '"& adminuser_selfconfig &"', '"& adminuser_isshow &"', '"& adminuser_language &"')"
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.