如何将一个ExecuteSQLTask实例(Microsoft.SqlServer.SQLTask)添加到DtsEventHandler?
构建ExecuteSQLTask是straight forward,但将其添加到事件处理程序可能需要某种类型的转换。
我不喜欢以这种方式创建它,因为我不能以这种方式将参数映射添加到结果集。除非有办法将参数添加到下面的可执行文件中?
<span id='thisNeedsToBeHere'><!-- notice arbitrary id name-->
<script type='text/javascript'
data-parm-one = 'foo'
data-parm-two = 'bar'
src='/dirOne/myJavascript.js'>
</script>
</span>
答案 0 :(得分:0)
你现在不需要ExecuteSQLTask,然后按照他们的参数绑定示例吗?
Executable execOnError = ehOnError.Executables.Add("STOCK:SQLTask");
TaskHost thOnError = (TaskHost)execOnError;
thOnError.Name = "sql_Exec_LogMessage_Error";
thOnError.SetExpression("SqlStatementSource", "@[User::sql_LogMessageError]");
thOnError.Properties["Connection"].SetValue(thOnError, cmag.ID);
ExecuteSQLTask task = thOnError.InnerObject as ExecuteSQLTask;
...
task.ParameterBindings.Add();
IDTSParameterBinding parameterBinding = task.ParameterBindings.GetBinding(0);
parameterBinding.DtsVariableName = "User::Variable";
parameterBinding.ParameterDirection = ParameterDirections.Input;
...