Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Urgent!! How to run DTS from VB 6 without hardcoding the server name?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-09-02 : 06:57:15
Louise writes "My question is how to run DTS from VB 6 without hardcoding the server name?
I have a DSN called SQLtest. I am using SQL server 2000 currently running on Windows2000. Can show me a sample code on how to run the DTS using the DSN?

thks alot for your helps!!"

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2003-09-02 : 09:11:44
You can firstly read the server name from the registry:

Dim w As New WshShell, ServerName
ServerName = w.RegRead("HKLM\Software\ODBC\odbc.ini\SQLtest\Server")
MsgBox ServerName

Though maybe there is a simpler way.
PS The above path to the SQL Server name is for Win98.
Go to Top of Page
   

- Advertisement -