. NET program calls a DTS package in SSIS

Source: Internet
Author: User
Program

The following code is the DTS package in the Intergration service that calls SQLServer2005 in vb.net (Framework 2.0).
1 if you want to invoke DTS in WebService, you must use the vb.net language. Because if you write WebService in C #, you will not be able to reference the Microsoft.SqlServer.ManagedDTS component.
2 Add the Network Service account to the Administrator group, or you will not be able to execute DTS. (a security vulnerability is created)


1 Imports Microsoft.SqlServer.Dts.Runtime
2
3 ' WebService code
4 <webmethod () > _
5 public Function Executepackage () as Integer
6 Dim pkg as String = "D:\DEVELOPMENT\PROGRAME\PACKAGEDEV\PACKAGE\MG-TSJF-PKG.DTSX"
7
8 Dim app as application = New application ()
9 Dim p as Package = App. Loadpackage (pkg, nothing)
Ten ' P.interactivemode = True
11
Dim vir as Variables = P.variables
Vir ("User::P Ackageid"). Value = 4
14
If P.execute (Nothing, vir, nothing, nothing, nothing) = Dtsexecresult.success Then
0
or Else
Return 1
The End If
End Function



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.