Link to home
Start Free TrialLog in
Avatar of WingYip
WingYip

asked on

VB.Net and DTS

How do you execute a sql DTS transaction from VB.net.

Can anyone help?

Wing
Avatar of _ys_
_ys_

Which version of SQL server are you running against?
I'll assume SQL 7.0 and continue. For SQL 2000 (SP3) there is a command-line utility that does what your looking for.


Add a project reference to 'Microsoft DTSPackage Object Library'. Then insert the following code:

Dim oPackage As DTS.Package = New DTS.Package( )
oPackage.LoadFromSQLServer( _
    ServerName:="{server-name}", _
    Flags:=DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection, _
    PackageName:="{package-name}")
oPackage.Execute( )
oPackage.UnInitialize( )
oPackage = Nothing

You can use SQL server authentication as well, but what to do with the password !?
Flags:=DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_Default
Avatar of WingYip

ASKER

Thanks for the response it's sql 2k actually

Command line utility?

wing
>> Command line utility?
It's called dtsrun.
More information is available on the ms site.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/coprompt/cp_dtsrun_95kp.asp
Avatar of Bob Learned
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: _ys_ {http:#9597107}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
Avatar of WingYip

ASKER

Sorry forgot to finish this one but I still have  a question here.

How do you deal with the sql 2k dtsrun command line utility in vb.net?

Wing
ASKER CERTIFIED SOLUTION
Avatar of _ys_
_ys_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WingYip

ASKER

fantastic!

Wing
np.

Finally got it sorted ...