Geeks Talk

Prepare for your Next Interview




Option Explicit

This is a discussion on Option Explicit within the ASP.NET forums, part of the Web Development category; What is the reason for using Option Explicit in ASP? In other words I want to know the usage of Option Explicit in ASP....


Go Back   Geeks Talk > Web Development > ASP.NET

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-31-2006
Contributing Member
 
Join Date: May 2006
Posts: 84
Thanks: 0
Thanked 9 Times in 6 Posts
timmy is on a distinguished road
Option Explicit

What is the reason for using Option Explicit in ASP? In other words I want to know the usage of Option Explicit in ASP.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-02-2006
Junior Member
 
Join Date: Jul 2006
Location: Chennai
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
tsanthi is on a distinguished road
Re: Option Explicit

Quote:
Originally Posted by timmy
What is the reason for using Option Explicit in ASP? In other words I want to know the usage of Option Explicit in ASP.
Hi
The Importance of Option Explicit in ASP is to avoid the usage of misSpelling variables .
For ex:
<%
sEmpID = request.form("TxtEmpID")
sEmpName = request.form("TxtEmpName")

response.write "Login ID : "&sEmpId &" Login Name "&sEpName
%>

Notice the misSpelling of sEmpName ,bcoz server automatically create a new variable (sEpName) with blank string and since we have not used Option Explicit , this error goes un-noticed.

When u use Option Explicit it must be the first line of ASP Script
<%
Option Explicit
dim sEmpId,sEmpName

sEmpID = request.form("TxtEmpID")
sEmpName = request.form("TxtEmpName")

response.write "Login ID : "&sEmpId &" Login Name "&sEpName
%>

In this case u got an Error like Variable is Undefined : sEpName.

This let's us know exactly where the error is, so we can go straight to the problem and fix it.

Santhi
Reply With Quote
Reply

  Geeks Talk > Web Development > ASP.NET


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Forum Editor Option Shivanna Geeks Lounge 0 05-29-2006 04:01 AM


All times are GMT -4. The time now is 12:41 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved