Solved

VBS - Copy Enumerations names and values into an array

Posted on 2004-04-21
1
210 Views
Last Modified: 2012-05-04
In VBS, I would like to use an Enumeration value in VBS without the worry of it changing with the next version of the DLL.  I have an example below of using the adUseClient Enumeration value with the Connection object.  I realize that Microsoft will not ever change adUseClinet from 3 to any other number, but other 3rd party objects may.

What I'm looking for is a workaround...  possibly storing Enumeration names and values in a multidimensional array, etc.  Any other thoughts and comments are encouraged.

'------------------------------
'this produces an error
'because of adUseClient
'------------------------------
dim ob
dim adUseClient

set ob = CreateObject("ADODB.Connection")
ob.Open "Provider=sqloledb;Data Source=dsd3dba;Integrated Security=SSPI"
ob.CursorLocation = adUseClient
set ob = Nothing
msgbox "done"
'------------------------------

Thank you.

Jessy Houle
0
Comment
Question by:jessy_houle
1 Comment
 
LVL 41

Accepted Solution

by:
graye earned 500 total points
ID: 10904718
So what you're asking for is a VBScript version of the standard "header files" (like the way C and C++ users are used to using).  

There isn't an official solution from Microsoft, but you could certainly build one yourself!   The newer WSF format for scripts supports an "include" directive.   You could then build a set of header files (based upon the C versions) and use them in your scripts.  If changes are required, a single change to the header would affect all of you script files.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now