Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTS and ActiveX VBScript

Status
Not open for further replies.

rewdee

Programmer
Aug 17, 2001
295
US
There must be a way of doing this but I don't know how. I want to run a VBScript but I need to retrieve the current packages Connections (Connection1 and Connection2). Maybe I'm off but something like:
Code:
  Dim Conn1, Conn2
  ...
  Set Conn1=CreateObject("ADODB.Connection")
  Set Conn2=CreateObject("ADODB.Connection")

  '''I know there's no Me variable but if there was'''
  Conn1 = Me.Connection1
  Conn2 = Me.Connection2

How do I get a reference to the current connections I'm using in my package?

Thanks,
Rewdee
 
Dim adoConn


Set adoConn = CreateObject("ADODB.Connection")

adoConn.Open "Provider=sqloledb;" & _
"Data Source=SERVER;" & _
"Initial Catalog=DB;" & _
"Integrated Security = SSPI;"

Thanks,

flan
 
Thanks flaniganmj for the response. Unfortunately, maybe I didn't explain this well.

I have an existing DTS package with 2 connections. These connections must be made via Enterprise Manager. All works well.

However, the customer wants to do something in a task that is more complicated then copying data. I'm writing the script but the problem is I don't know what the connection properties they have used. I cannot create a connection string since the DTS package shipped is edited by the customer (assigns the properties of Connection1 & Connection2). That is why I need to retrieve the Connection1 properties and assign it to Conn1. Any hints would be appreciated.

Thanks,
Rewdee
 
CreateObject always creates or launches the object. GetObject acquires an existing instance of the object. Given the difference between these, I am not sure that you are going to be able to do what you want to do. In any case, I don't think you can use CreateObject.

And, GetObject needs a context to know what object to get, so I don't know if that would even work.

The only promise is if there is a way to enumerate active connections.

To use your Me example, if Me was the only open form in MS Access, you could also reference it with Forms(0), and you could do things like Forms.Count or "For Each F In Forms". Who knows if such a collection object exists for connections.

-------------------------------------
There are 10 kinds of people in the world: those who know binary, and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top