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!

Reference to local server in ActiveX Script

Status
Not open for further replies.

rickj65

Programmer
Jun 5, 2002
79
US
I have several ActiveX scripts as part of various packages I run. Within these scripts I set a connection to the local server that's running the DTS packages.

For example:

Dim conMyCon
Dim strConnection

Set conMyCon = CreateObject("ADODB.Connection")
strConnection = "Provider=SQLOLEDB.1; " & _
"Data Source=MyServer; " & _
"Initial Catalog=MyDb; " & _
"user id =sa;password=MyPass;"
conMyCon.Open = strConnection

The problem is that when I move my packages from one server to another (from test to production), I have to go into each ActiveX script and change the Data Source parameter to the name of the new server it resides on.

Is there a way that I can refer to the current (local) server in the ActiveX script so that I don't have to hardcode the server name?

Thanks,

Rick
 
Dim conMyCon
Dim strConnection

Set conMyCon = CreateObject("ADODB.Connection")
strConnection = "Provider=SQLOLEDB;" & _
"Data Source=(local);" & _
"Database=MyDb;" & _
"user id =sa;password=MyPass;"

conMyCon.Open = strConnection
 
Thanks for your reply.

Unfortunately I've tried using the (local) designation for the datasource; however, it returns the error message:

"SQL Server does not exist or access denied"

I believe I'm getting this error because I'm developing (and running) the package through EM on a remote machine...not 100% sure on that one.

Any other ideas?

Thanks,

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top