Check if variable has been declared in ASP
Posted on 2003-10-23
Im writing a script and i want to check whether a variable has been declared or not. My database connection name is objConn, and so i want to check whether that variable has been declared, if it hasnt the user is on a page that has no database driven content and so i dont want to query the DB...
I use IsObject(objConn) to check whether the variable is an object but because i have option explicit on every page that returns an error...
I could turn on On Error Resume Next before the IsObject statement but i dont like to do this because i will never know if theres an error.
Any ideas or solutions anyone....
Thanks in advance