我们已经创建了一个作为 SSIS 包的工作流过程,并希望找到一种方法来访问此代码,以便我们可以通过 vb 动态访问和运行该代码.例如,我们想更改正在使用的数据源,或更改现有包的列映射,然后从 vb 应用程序执行它们.请建议最好的方法.
We have created a workflow process as an SSIS package and would like to find a way of gaining access to this code so that through vb we can dynamically access and run that code. For example, we would like to change the data sources being used, or change the column mappings of existing packages and then execute them from a vb application. Please advise the best way to do this.
推荐答案你会发现你的一些任务很容易,而另一些则不然.
You will find some of your tasks easy, others not so much.
一般来说,您会感兴趣阅读集成服务开发人员指南.特别感兴趣的是以编程方式构建包和以编程方式运行和管理包.
Generally speaking, you'll be interested in reading the Developers Guide to Integration Services. Of particular interest will be Building Packages Programmatically and Running and Managing Packages Programmatically.
例如,从 VB.NET 运行包
Imports Microsoft.SqlServer.Dts.Runtime Module Module1 Sub Main() Dim pkgLocation As String Dim pkg As New Package Dim app As New Application Dim pkgResults As DTSExecResult pkgLocation = _ "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services" & _ "\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx" pkg = app.LoadPackage(pkgLocation, Nothing) pkgResults = pkg.Execute() Console.WriteLine(pkgResults.ToString()) Console.ReadKey() End Sub End Module要以编程方式更改连接管理器,它与 VB.NET 等效
To change the connection manager programmatically, it'd be the VB.NET equivalent of
ConnectionManager item = ep.Connections["MyConnectionManagerName"] item.ConnectionString = @"Provider=SQLNCLI10.1;Data Source=Server1;Initial Catalog=ABC;Integrated Security=SSPI;";改变列映射,这就是它会变得有趣的地方,对于这个词的所有定义.我有一个精炼的例子,但它需要一些工作,你会想要真正理解整个对象模型(我希望你喜欢 COM).EzAPI 可能在这方面有所帮助.
Changing column mappings, that's where it's going to get interesting, for all definitions of the word interesting. I'm have a distilled example but it takes some work and you'll want to really understand the whole object model (and I hope you like COM). EzAPI might be of some assistance in that area.
更多推荐
如何在 VB 中以编程方式编辑 SSIS 包?
发布评论