ASP Learning: ASP page Development Skills

Source: Internet
Author: User
Tags variables servervariables microsoft frontpage
Tips | page ASP (Active Server page) provides strong technical support for making dynamic pages. In an ASP page, you can have multiple submit buttons to submit different data, perform different operations, and these all return to the same ASP page. The following is a program to perform a query (find a new ID number), change, and add to the Auto exhibition site database, as follows:

Caredit.asp Program

〈script language=″vbscript″runat=″server″〉

When you go to FP98, the following ″ return ″ two characters will not be garbled

〈/script〉

〈%if Request.Form (″cmdback″) =″ return ″then

Click Cmdback button to jump to carqry.asp page

Response.redirect″carqry.asp″

End if%〉

〈html〉

〈head〉

〈meta http-equiv=″content-type″content=″text/html; charset=gb_2312-80″〉

〈meta name=″vi60_defaultclientscript″content=″javascript″〉

〈meta Name=″generator″content=″microsoft FrontPage 3.0″〉

〈title〉 China Automobile Service special Network Auto exhibition field 〈/title〉

〈%if request.querystring (″idv″) 〈〉″″and Request.ServerVariables (″request_method″) =″get″then

If it's another page with parameters call this page is True

End If

If Request.ServerVariables (″request_method″) =″post″then

If this is the page to perform the commit operation is true

If Request.Form (″cmdupdate″) =″ change ″

Then

The Cmdupdate button is true if it is clicked

End If

If Request.Form (″cmdnew″) =″ new ID number ″

Then

The Cmdnew button is true if it is clicked

End If

If Request.Form (″cmdinsert″) =″ add ″

Then

The Cmdinsert button is true if it is clicked

End If

End if%〉

〈%cn.close%〉

〈/script〉

〈/head〉

〈body background=″images/backgrnd.jpg″〉

〈form Method=″post″name=″frmedit″language=″javascript″

Onsubmit=″return Forminput_onsubmit () ″〉

〈div align=″center″〉〈center〉〈h5〉

〈input Type=″submit″name=″cmdupdate″value=″ Change ″〉

〈input Type=″submit″name=″cmdnew″value=″ new ID number ″〉

〈input Type=″submit″name=″cmdinsert″value=″ Add ″〉

〈input Type=″button″name=″cmdback″value=″ return to ″onclick=″javascript:window.opener.focus () ″〉

〈/h5〉

〈/center〉

〈/div〉

〈/form〉

〈/body〉

〈/html〉

In the Caredit.asp program, the first three buttons are the Submit button, and the "Back" button is a normal button. Click on the first three buttons on the Caredit.asp page to perform the submit operation, but the content is different; the "Back" button gathers focus to the parent window that opens the page window.

When the ASP page has the same function of the output part, you can make the same part of a separate ASP page, in the location of the call to enter 〈!--#include file=″asp filename ″--〉 can be.

Debugging an ASP page can refer to Vidv's description settings, and it is quicker to surround variables that need to be viewed directly with "〈%=" and "%〉", and surround them with "%〉〈%=" and "%〉〈%" when outputting variables in a server-side code program. Similarly, when you want to agree to the report, write 〈%=″ the output of the report where you want to output the content ″%〉.

When the SQL statement of the server-side code contains variables, the following two cases are divided:

The ① variable is represented by a ′″& variable &″′ when it is a character, date type, such as:

Sql=″select name from student where Name=′″&namev&″′″

The ② variable is represented by a ″& variable &″ as a numeric, logical type, such as:

Sql=″select name from student where Score〉″&scorev&″″

In the example above, the variable ends with the letter V to show the difference.



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.