在ForLoop容器中使用脚本任务时出错 [英] Error using Script Task inside a ForLoop Container

查看:67
本文介绍了在ForLoop容器中使用脚本任务时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的变量是MyCounter类型int32和值1.



尝试编写脚本:



My Variable is MyCounter type int32 and value 1.

Trying to write the script:

public void Main()
{
    MessageBox.Show(Dts.Variables("MyCounter").Value);
Dts.TaskResult = (int)ScriptResults.Success;
}





我收到以下错误:

非可调用成员'Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel.Variables'不能像方法一样使用。



需要帮助

谢谢

Dov



I get the following error:
Non-invocable member 'Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel.Variables' cannot be used like a method.

Need help
Thanks
Dov

推荐答案

在C#中,使用方括号[]进行索引;不是括号。



In C#, you use square brackets [ ] for indexing; not parentheses.

public void Main()
{
    MessageBox.Show(Dts.Variables["MyCounter"].Value);
Dts.TaskResult = (int)ScriptResults.Success;
}


这篇关于在ForLoop容器中使用脚本任务时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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