以下代碼是在VB
NET(Framework
)中調用SQLServer
的Intergration Service中DTS包
如果要在WebService中調用DTS
必須用VB
NET語言
因為如果用C#編寫WebService的話
將無法引用Microsoft
SqlServer
ManagedDTS組件
將NETWORK SERVICE帳戶添加到Administrator組中
否則將不能執行DTS
(會帶來安全漏洞)
Imports Microsoft
SqlServer
Dts
Runtime
WebService代碼
_
Public Function ExecutePackage() As Integer
Dim pkg As String =
D:\Development\Programe\PackageDev\Package\MG
TSJF
PKG
dtsx
Dim app As Application = New Application()
Dim p As Package = app
LoadPackage(pkg
Nothing)
p
InteractiveMode = True
Dim vir As Variables = p
Variables
vir(
用戶::PackageID
)
Value =
If p
Execute(Nothing
vir
Nothing
Nothing
Nothing) = DTSExecResult
Success Then
Return
Else
Return
End If
End Function
From:http://tw.wingwit.com/Article/program/net/201311/12761.html