简体   繁体   English

动态数据类型在SSIS脚本任务中不起作用

[英]dynamic datatype not working in SSIS script task

I declared a variable as below in script task 我在脚本任务中声明了如下变量

dynamic sqldata = Dts.Variables["User::sqldata"].Value;

When I try to click OK for script task component, error coming as below 当我尝试为脚本任务组件单击“ 确定 ”时,错误如下

在此处输入图片说明

But when I replace dynamic keyword with object or var , which works fine. 但是当我将动态关键字替换为object或var时 ,效果很好。

So why dynamic datatype not working in script task? 那么为什么动态数据类型不能在脚本任务中工作呢?

stumbled across query when I had this same error myself so I thought I'd share my findings. 当我自己遇到同样的错误时,偶然发现了所有查询,因此我想与大家分享我的发现。 My solution was to add Microsoft.CSharp as a reference when editing the script. 我的解决方案是在编辑脚本时添加Microsoft.CSharp作为参考。

  1. Edit the script component in the dataflow 编辑数据流中的脚本组件
  2. Edit the script 编辑脚本
  3. Right click on References in the Solution Explorer 在解决方案资源管理器中右键单击引用
  4. Add the reference "Microsoft.CSharp" 添加引用“ Microsoft.CSharp”
  5. Use it in your class - Using Microsoft.CSharp; 在您的课程中使用它-Using Microsoft.CSharp;

Hope that helps! 希望有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM