Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBS - Copy Enumerations names and values into an array

Posted on 2004-04-21
1
Medium Priority
?
222 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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 …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

597 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