dbTalk Databases Forums  

Vb & DTS

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Vb & DTS in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Peter Newman
 
Posts: n/a

Default Vb & DTS - 03-22-2005 , 04:37 AM






VB6 ( SP6 ) & SQL 2000

In my vb code i have a public connection to to the SQLServer by using the
following code

Set UserDbconnect = New ADODB.Connection
UserDbconnect.ConnectionTimeout = 60
UserDbconnect.ConnectionString = "DSN=MyDSN;UID=MYUID;PWD=MYPWD;"
UserDbconnect.Open

This works fine for executing Stored procedures and Select queries, however
when firing off a DTS, the only way i know how is using the code below


sServer = ServerName
sUsername = UserName
sPassword = UserPassword
sPackageName = DTSName

' Load Package
oPKG.LoadFromSQLServer sServer, sUsername, sPassword, _
DTSSQLStgFlag_Default, , , , sPackageName

Does anyone know of a way to use the curent database connection rather than
having to hard code in the server name etc ?

Reply With Quote
  #2  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: Vb & DTS - 03-22-2005 , 06:53 AM






A few options using t-sql statements would be-
1. Use xp_cmdshell and execute dtsrun.
2. Use the automation stored procedures (sp_OAxxxx stored
procedures) to load and execute the package
You can find sample code in this article:
http://www.databasejournal.com/featu...le.php/1459181
3. You could put your dtsrun to execute the package in a job
and just call sp_start_job.

-Sue

On Tue, 22 Mar 2005 02:37:04 -0800, Peter Newman
<PeterNewman (AT) discussions (DOT) microsoft.com> wrote:

Quote:
VB6 ( SP6 ) & SQL 2000

In my vb code i have a public connection to to the SQLServer by using the
following code

Set UserDbconnect = New ADODB.Connection
UserDbconnect.ConnectionTimeout = 60
UserDbconnect.ConnectionString = "DSN=MyDSN;UID=MYUID;PWD=MYPWD;"
UserDbconnect.Open

This works fine for executing Stored procedures and Select queries, however
when firing off a DTS, the only way i know how is using the code below


sServer = ServerName
sUsername = UserName
sPassword = UserPassword
sPackageName = DTSName

' Load Package
oPKG.LoadFromSQLServer sServer, sUsername, sPassword, _
DTSSQLStgFlag_Default, , , , sPackageName

Does anyone know of a way to use the curent database connection rather than
having to hard code in the server name etc ?


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.