?
Solved

VBS - Copy Enumerations names and values into an array

Posted on 2004-04-21
1
Medium Priority
?
218 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
[X]
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
1 Comment
 
LVL 41

Accepted Solution

by:
graye earned 1500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

764 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