以下代码是在VB
NET(Framework
)中调用SQLServer
的Intergration Service中DTS包
如果要在WebService中调用DTS必须用VBNET语言因为如果用C#编写WebService的话将无法引用MicrosoftSqlServerManagedDTS组件
将NETWORK SERVICE帐户添加到Administrator组中否则将不能执行DTS(会带来安全漏洞)
Imports MicrosoftSqlServerDtsRuntime
WebService代码
_
Public Function ExecutePackage() As Integer
Dim pkg As String = D:\Development\Programe\PackageDev\Package\MGTSJFPKGdtsx
Dim app As Application = New Application()
Dim p As Package = appLoadPackage(pkg Nothing)
pInteractiveMode = True
Dim vir As Variables = pVariables
vir(用户::PackageID)Value =
If pExecute(Nothing vir Nothing Nothing Nothing) = DTSExecResultSuccess Then
Return
Else
Return
End If
End Function