找回密码
 注册
搜索
热搜: 回贴

.NET程序调用SSIS中的DTS包

2009-12-13 12:45| 发布者: admin| 查看: 62| 评论: 0|原作者: 玄霄

◎以下代码是在VB.NET(Framewo......


以下代码是在VB.NET(Framework 2.0)中调用SQLServer2005 的Intergration Service中DTS包。
1 如果要在WebService中调用DTS,必须用VB.NET语言。因为如果用C#编写WebService的话,将无法引用Microsoft.SqlServer.ManagedDTS组件。
2 将NETWORK SERVICE帐户添加到Administrator组中,否则将不能执行DTS。(会带来安全漏洞)

1 Imports Microsoft.SqlServer.Dts.Runtime
2
3 'WebService代码
4 _
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)
10 'p.InteractiveMode = True
11
12 Dim vir As Variables = p.Variables
13 vir("用户::PackageID").Value = 4
14
15 If p.Execute(Nothing, vir, Nothing, Nothing, Nothing) = DTSExecResult.Success Then
16 Return 0
17 Else
18 Return 1
19 End If
20 End Function

最新评论

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-29 23:28 , Processed in 0.117501 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

返回顶部