无法从vb6执行SSIS包(Cannot execute SSIS package from vb6)

编程入门 行业动态 更新时间:2024-10-24 16:22:00
无法从vb6执行SSIS包(Cannot execute SSIS package from vb6)

我试图从vb6应用程序执行一个简单的SSIS包。 我可以从c#执行相同的包。

这是我在vb6中的代码:

pkgLocation = "c:\Package.dtsx" Set dtsApp = New Application Set package = dtsApp.LoadPackage(pkgLocation, True, Nothing) Set pkgContainer = package pkgResults = package.Execute If (pkgResults = 0) Then MsgBox "Success" Else MsgBox "Fail" End If

在我的日志文件中,我看到此错误:任务上的Execute方法返回错误代码0x80131621(混合模式程序集是针对运行时的版本'v2.0.50727'构建的,如果没有其他配置信息,则无法在4.0运行时加载。) 。 Execute方法必须成功,并使用“out”参数指示结果。

我的c#程序我必须添加一个App.config文件来解决同样的错误:

<?xml version="1.0"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration>

但是如何从vb6应用程序中执行相同的操作?

编辑1:

在我的vb6项目中,我使用的是这样的引用:

C:\ Program Files(x86)\ Microsoft SQL Server \ 120 \ DTS \ Binn \ DTS.DLL - Microsoft DTS Runtime 1.0 C:\ Program Files(x86)\ Microsoft SQL Server \ 120 \ DTS \ Binn \ MsDtsSrvrUtil.dll - Dts Server 9.0类型库

SSIS包是使用:用于Visual Studio 2013的Sql Server数据工具制作的

谢谢你的帮助。

I am trying to execute a simple SSIS package from vb6 application. I can execute the same package from c#.

This is my code in vb6:

pkgLocation = "c:\Package.dtsx" Set dtsApp = New Application Set package = dtsApp.LoadPackage(pkgLocation, True, Nothing) Set pkgContainer = package pkgResults = package.Execute If (pkgResults = 0) Then MsgBox "Success" Else MsgBox "Fail" End If

In my log file, I see this error: The Execute method on the task returned error code 0x80131621 (Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.). The Execute method must succeed, and indicate the result using an "out" parameter.

I my c# program I have to add an App.config file to resolve the same error:

<?xml version="1.0"?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration>

But How can I do the same from vb6 application?

Edit 1:

In my vb6 project I am using this references:

C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\DTS.DLL - Microsoft DTS Runtime 1.0 C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\MsDtsSrvrUtil.dll - Dts Server 9.0 Type Library

The SSIS package was made with : Sql Server Data Tools for Visual Studio 2013

Thanks for your help.

最满意答案

我在这篇文章中找到了解决方案使用app.config和Interop Controls

简而言之:如果我的VB6 exes名为VB6.exe,我需要将文件VB6.exe与App.config文件放在同一目录下,但重命名为VB6.exe.config

I found the solution in this post Using app.config with Interop Controls

In short : If my VB6 exe es called VB6.exe , I need to put in the same directory as the file VB6.exe the App.config file but renamed VB6.exe.config

更多推荐

本文发布于:2023-08-04 06:26:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1409356.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:SSIS   package   execute

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!