Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

VBS - Copy Enumerations names and values into an array

Posted on 2004-04-21
1
213 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
notReplace  challenge 53 141
lucky13 challenge 11 153
has12 challenge 13 73
split53 challenge 7 109
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to implement Singleton Design Pattern in Java.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

809 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