ASP Basics Tutorial: ASP Script Basics

Source: Internet
Author: User
Tags web database

Through the first two studies, I am sure you have a basic concept and the overall impression of the dynamic website design of ASP. From the beginning of this article, the author will start from the use of scripting language, to lead you to explore the real mystery of ASP dynamic website design.

After the second article published, many friends sent me a "sister son", hoping to see the third, four and even the first article ... , and even a friend anxiously asked me to send him the full text of the ASP. Seeing so many like-minded friends makes me feel great. Although the ASP has been launched two years ago, but until this year it is flexible and convenient development process, good Web database connectivity has been the attention of the people, however, because there is still a lack of information on ASP Development Web application of the detailed textbook, so that the vast number of domestic web developers are still in the closed-door chewing The stage of E-text also includes the author himself. Because of this, the author Caimont wrote the idea of writing an article, in the Chinabyte Network College, Mr. Hongbin's strong support, you can see this article.

The author earnestly hope that through this article for the vast number of WEB developers and enthusiasts to facilitate, so that everyone together to participate in the study and exchange of ASP, in order to cover the needs of different levels of readers of the author or decided to start from the most basic scripting language, then a step by step to explain the ASP built object, ActiveX Components and examples of developing WEB applications with ASP, I believe that through a period of continuous learning, in a few months you can easily develop their own dynamic website. Here's the first to ask you to learn some of the basics of scripting language (VBScript-based) in ASP.

Before you start learning scripting languages, you should understand some simple concepts-variables, processes. A variable is a named storage location in computer memory that contains data such as numbers or strings, which makes it easy for users to understand the name of a script operation and provides a way for users to store, retrieve, and manipulate data. A program is made up of one or more processes, in VBScript, the process is the "instruction block", usually in the sense of a process, such as a Sub, just for simple data processing.

In VBScript, strictly speaking, variables are not declared,

such as:<% mystring= "This is my string"% >

However, even if you do not need to declare variables before using them, you should develop a good habit of declaring variables at programming time, as this helps prevent errors from occurring. Declaring a variable means telling the scripting engine that there is a variable of a specific name so that the variable can be referenced in the script. Declaring a variable in VBScript can use the "Dim" statement, as follows:

< script language= "VBScript" >

<!--

Option Explicit \ ' requires that all variables be declared in the script

Dim Mystring

Mystring= "This is my string"

-->

</script>

The scope of the variable is the lifetime, which determines which script commands can access the variable. Variables declared inside a procedure have local scope. Each time the process is executed, the variable is created and then dies. And no command outside of the procedure can access it. Variables declared outside the procedure have global scope, and their values can be accessed and modified by any script command on the ASP page. When declaring a variable, local variables and global variables can have the same name. Changing one of the values does not change the value of the other. If you do not declare a variable, you may accidentally change the value of a global variable. For example, the following script command returns a value of 1, although there are two named Y variables:

<%

Dim YY = 1Call setlocalvariableresponse.write Y

Sub setlocalvariable

Dim Y

Y = 2End Sub% >

Because the variable is not explicitly declared, the following script command returns 2. When the procedure call sets Y to 2 o'clock, the script engine considers the procedure to modify the global variables:

ASP Basics Tutorial: ASP Script Basics

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.