Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Checking if Object Exists with VBScript

2,509 views
Skip to first unread message

Julie

unread,
Mar 19, 2001, 6:16:00 PM3/19/01
to
Hello...

I am working on a web application using vbscript & java. When a user logs in I
create a temporary table that gets deleted when they log out. No problem with
this.

At some point during the users session they may need to go back to the page where
the table was created so I need to be able to check to see if the table exists
before I try to create it.

Can anyone help me out with the syntax to check to see if the table exists?

TIA,
Julie

Randy Hunt, MCSE

unread,
Mar 19, 2001, 9:02:41 PM3/19/01
to
Julie says:

>Can anyone help me out with the syntax to check to see if the table exists


Visit http://msdn.microsoft.com/scripting/ and download the VBScript
documentation.

You can use the TypeName() function to check for an object.


----------
Randy Hunt
MCP+I / MCSE

visit www.wshscripting.com

Michael Harris

unread,
Mar 19, 2001, 9:21:46 PM3/19/01
to
When you create the temporary table, use a session variable to indicate that it exists.

In global.asa (in OnSessionStart() ) initialized the session variable to false.

Check the session variable before creating the table and then reset the session variable to true
once the table is created.

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Julie" <ju...@anms.net> wrote in message news:28da01c0b0ca$8fb5c2b0$9ee62ecf@tkmsftngxa05...

Paul Heuts

unread,
Mar 20, 2001, 4:18:59 PM3/20/01
to
Maybe you could use the IsObject function;

Returns a Boolean value indicating whether an expression references a valid
Automation object.

IsObject(expression)

The expression argument can be any expression.

Remarks
IsObject returns True if expression is a variable of Object subtype or a
user-defined object; otherwise, it returns False.

The following example uses the IsObject function to determine if an
identifier represents an object variable:

Dim MyInt, MyCheck, MyObject
Set MyObject = Me
MyCheck = IsObject(MyObject) ' Returns True.
MyCheck = IsObject(MyInt) ' Returns False.

"Michael Harris" <mik...@mvps.org> wrote in message
news:esdsDSOsAHA.2152@tkmsftngp03...

Julie

unread,
Mar 21, 2001, 8:57:05 PM3/21/01
to
Thanks Mike...

Works great! Just one question, what is the impact of using session variables if
a users browser does not support cookies or they have them turned off?

Any wisdom you can impart would be great!

Julie

TIA,
Julie


.

Michael Harris

unread,
Mar 21, 2001, 9:18:13 PM3/21/01
to
"...what is the impact of using session variables if a users browser does not support cookies or
they have them turned off?..."

Then they don't work since the whole "Session" concept depends on cookies.

See the following KB article...

Q175167 - HOWTO: Store State in Active Server Pages Applications
http://support.microsoft.com/support/kb/articles/Q175/1/67.ASP

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Julie" <ju...@anms.net> wrote in message news:3d9d01c0b273$651804f0$b1e62ecf@tkmsftngxa04...

0 new messages