Prevent Programming Errors in Your ASP Codes

Prevent Programming Errors in Your ASP Codes

ASP, we may encounter some errors in programming, we have explained the ways to fix some errors in your ASP Code Prevent Programming Errors. ASP opens a session (Session) to a visitor entering our site and keeps some variables in mind during the session. To use a variable that you use on a page on a later page, the value of this variable should not change on the new page. When you write the ASP program, you can sometimes assign value to the arrival-nice variables. (We recommend that you read our topic about Variables in ASP.) Why? For that it doesn't come up with the word you'll name variable at the moment! If you've used this variable name before, and there's a value you'll be using in a bit, the value will be changed. VBScript provides OPTION EXPLICIT to prevent wasteful and messy programming.

As the first line of an ASP page

<% OPTION EXPLICIT%>

VBScript does not allow you to use an undefined variable with the DIM command; if you use the error and stops.

Another point that this statement will benefit your business is to prevent you from making mistakes when writing the variable name in the code. VBScript will count the wrong word because it doesn't know you made a mistake. If you use this new variable that you do not assign value, either your program gives an error, or it performs correctly, but you cannot get the result you expect. OPTION EXPLICIT will stop by thinking that you are using an undefined variable by counting the new variable you wrote incorrectly.

Well, how would you describe a variable that would make a variable:

<%
DIM Guns (31), Months (12), Students (210), Notes (10)
%>

"Containers," which can be obtained by the codes we create with this method, can hold more than one value. So:

<%
DIM Guns (7), Months (12), Students (21), Notes (10)
Gunler (1) = "Monday"
Months (3) = "March"
Students (12) = "Necip"
Notes (5) = 5
%>

In this case, the number of days variable which can keep 7 different variables in the value of "Monday," 12 value that can keep the value of the number of months, the number 3 of the "March," the value of the number of students who can hold 21 separate value of the number 12 "Necip" and finally 10 separate The value of the Notes variable that can hold a value of 5 will be 5. Variables such as Array Variable or Array are called variables that can hold more than one value.

Click to access our topic about ASP Elements.