0

我在 SSIS 2008 上设置了一个包,其中包含一个运行 excel 宏的 vb 脚本。它适用于商业智能开发工作室(BIDS) 2008,但我仍然收到以下错误:

Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. 
at ST_e916156b0e6449b58e21905bd635ecf0.vbproj.ScriptMain.Main() 
--- End of inner exception stack trace --- 
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) 
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) 
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) 
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) 
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture) 
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript() 

此外,当我使用 SQL 代理运行包时,作业成功但未执行宏,并且出现以下错误:

Executed as user: 'myusername'. 
Code: 0xFFFFFFFF 
Source: Run macro script excel macro Description: Microsoft Excel cannot access the file 'book1.XLS'. 
There are several possible reasons: 
? The file name or path does not exist. 
? The file is being used by another program. 
? The workbook you are trying to save has the same name as a currently open workbook. 
End Error 
DTExec: The package execution returned DTSER_SUCCESS (0). 
Started: 11:18:15 Finished: 11:18:19 
Elapsed: 3.775 seconds. 
The package executed successfully. The step succeeded. 

但是,我可以完全访问本地服务器和网络,并且尝试在 32 位和 64 位上运行,但没有成功。

我该如何解决这个问题?

4

1 回答 1

0

你可以尝试的事情:

以我个人的经验,Excel 在使用 SSIS 时总是很棘手。正如您从错误消息中看到的那样,请确认您可以排除与该问题相关的以下信息。

  • 检查运行 SQL Server 代理服务的用户帐户。您可以通过导航到Windows Start\ Control Panel\ Administrative Tools\来执行此操作Services。查找名为的服务SQL Server Agent (<your instance name>)

  • 确保该帐户确实有权访问存储 Excel 文件的文件夹。

  • 确认您没有打开 Excel 文件。

  • SQL Server 代理作业上,单击执行包的步骤。如果您在 type 下运行包SQL Server Integration Services Package,请确保您已User 32 bit runtime选中Execution options选项卡上的框。

  • 您也可以手动双击包文件 (.dtsx)。这将带来DTEXEC执行包的实用程序。如果您使用的是配置文件,请在配置选项卡上附加配置文件。运行包。如果它DTEXEC在您的凭据下的实用程序中运行,但不在 SQL Server 代理下,我通常发现这是相关的权限问题。

于 2013-02-21T14:57:47.653 回答