从vb代码运行dtsx包 [英] Runs dtsx package from vb code

查看:155
本文介绍了从vb代码运行dtsx包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 -



我有一个网页,我正在尝试访问ssis包并运行导入。问题是包失败并出现错误



'无法打开包文件@P:\ Users \ TroyB \ KitImport.dtsx到期错误0x8007007B文件名,目录名称或卷标语法不正确。加载包时会发生这种情况,并且无法将文件正确打开或加载到XML文档中。这可能是因为在调用LoadPackage时指定了错误的文件名,或者指定了XML文件并且格式不正确.'



excel文件位置现在是硬编码以及导入包的位置。以下是我关注的示例:从ASP.Net中取代SSIS包(DTSX) [ ^ ]



以下是代码:



Hi -

I have a web page that I'm trying to access an ssis package and run the import. The issue is that the package fails with an error of

'Failed to open package file "@P:\Users\TroyB\KitImport.dtsx" due to error 0x8007007B "The filename, directory name, or volume label syntax is incorrect.". This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage or the XML file was specified and has an incorrect format.'

The excel file location is hard coded for now along with location of the import package. Here is the example of that I was following :Excecute SSIS package (DTSX) from ASP.Net[^]

Here is the code :

Dim pkgLocation As String
Dim pkg As New Package
Dim app As Application = New Application
Dim pkgResults As DTSExecResult
Dim fileName As String = "@P:\Users\TroyB\MyKitImport.xls"
Dim eventListener As New EventListener
pkgLocation = "@P:\Users\TroyB\KitImport.dtsx"
pkg = app.LoadPackage(pkgLocation, eventListener)
pkgResults = pkg.Execute()





提前致谢



Thanks in advance

推荐答案

错误完全正确且清晰。您正在尝试打开@P:\Users\TroyB\KitImport.dtsx。请注意,路径中包含@。如果你从C#复制,@是一个特殊的代码,所以\不会被视为转义字符。



既然你在做VB,你不需要那个@。
The error is exactly correct and clear. You are trying to open "@P:\Users\TroyB\KitImport.dtsx". Note that you have the "@" in your path. If you copied from C# the @ is a special code so that \ does not get treated as an escape character.

Since you are doing VB you don't need that @.


这篇关于从vb代码运行dtsx包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆