All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
.NET程序调用SSIS中的DTS包_.net资料_编程技术

Writer: aaa Article type: Programming skills(编程技巧) Time: 2013/12/6 10:16:40 Browse times: 382 Comment times: 0

.NET程序调用SSIS中的DTS包_.net资料_编程技术-数科优化网


Head photo

Go homepage
Upload pictures
Write articles

.NET程序调用SSIS中的DTS包_.net资料_编程技术-数科优化网

以下代码是在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






There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.