What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Enumeration?

Enumeration?
Author: Message:
Zero
Junior Member
**

Avatar

Posts: 29
– / Male / Flag
Joined: Aug 2008
O.P. Enumeration?
Hi folks, I guess this is just a basic programming question, but I've been reading the MSDN doc's on JScript's enumeration object and am having troubles 'getting it'.

In my specific scenario, I've opened a connection to a database using the ADODB object. That object has a property called State, which has several values to indicate what's going on with the connection - adStateOpened, adStateClosed, etc, all of type "ObjectStateEnum".

I know the numeric values for these constants, but don't want to have to refer to them as numbers as that's less meaningful than using the given enumerated names. What do I need to do to have access to them in my script??? So, for example, I could write:

code:
if (objDBHandle.State == adStateOpened) { ... }


Instead of...

code:
if (objDBHandle.State == 1) { /* Opened state */ ... }


or...

code:
var _adStateClosed = 0;
var _adStateOpened = 1;
/* ... more states ... */

if (objDBHandle.State == 1) { /* Opened state */ ... }


Ideas?





This post was edited on 09-16-2008 at 07:34 PM by Zero.
09-16-2008 07:29 PM
Profile E-Mail PM Web Find Quote Report
vaccination
Veteran Member
*****

Avatar

Posts: 2513
Reputation: 43
32 / Male / –
Joined: Apr 2005
RE: Enumeration?
code:
var _adStateClosed = 0;
var _adStateOpened = 1;
/* ... more states ... */

if (objDBHandle.State == _adStateOpened) { /* Opened state */ ... }



will work

This post was edited on 09-16-2008 at 07:52 PM by vaccination.
[Image: jumbled.png]
09-16-2008 07:51 PM
Profile PM Find Quote Report
TheSteve
Full Member
***

Avatar
The Man from Japan

Posts: 179
Reputation: 23
40 / Male / Flag
Joined: Aug 2005
RE: Enumeration?
Can you use the enum statement (not sure if plus uses JScript .NET)?

http://msdn.microsoft.com/en-us/library/y94acxy2(VS.71).aspx
09-18-2008 12:44 AM
Profile PM Web Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: Enumeration?
quote:
Originally posted by TheSteve
(not sure if plus uses JScript .NET)?

it doesn't. you can't.
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
09-18-2008 01:09 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On