Prepare for your Next Interview
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....
|
|||
|
Re: Option Explicit
Quote:
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 |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Forum Editor Option | Shivanna | Geeks Lounge | 0 | 05-29-2006 04:01 AM |