<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: SSIS &#8211; Using the API</title>
	<atom:link href="http://www.ssistalk.com/2008/12/31/ssis-using-the-api/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ssistalk.com/2008/12/31/ssis-using-the-api/</link>
	<description>Random thoughts and experiences with SSIS, by Phil Brammer</description>
	<lastBuildDate>Wed, 25 Jan 2012 10:27:44 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Chiru</title>
		<link>http://www.ssistalk.com/2008/12/31/ssis-using-the-api/comment-page-1/#comment-29993</link>
		<dc:creator>Chiru</dc:creator>
		<pubDate>Tue, 26 Jul 2011 21:27:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.ssistalk.com/?p=104#comment-29993</guid>
		<description>Hi, I am using EzAPI to generate SSIS package with a Execute script task followed by a Data flow transformation. I am getting error while assigning connection to SQL task, I believe ez execute sql task host is unable to cast to ExecuteSQLTask object. b.t.w 
ResultSetBindings property is not present by default, I manually changed the EzExecSqlTask code to expose IDTSResultBindings.  Here is my code in Main function of a console application.

EzPackage pkg = new EzPackage();
//Create EzConnection and add it to package connections
EzConnectionManager ezConn = AddEzConnection(pkg, &quot;OLEDB&quot;, @&quot;.\SQLEXPRESS&quot;, &quot;AdventureWorks&quot;);

EzExecSqlTask sourceEntitySql = new EzExecSqlTask(pkg);
            sourceEntitySql.Name = &quot;sourceEntitySql&quot;;
            sourceEntitySql.Connection = ezConn; //Here is where exception occurs
            sourceEntitySql.SqlStatementSourceType = SqlStatementSourceType.DirectInput;
            sourceEntitySql.ResultSetType = ResultSetType.ResultSetType_SingleRow;
            sourceEntitySql.SqlStatementSource = &quot;select City from	[Person].[Address] where	AddressID=?&quot;;
            sourceEntitySql.BypassPrepare = true;

            sourceEntitySql.ParameterBindings.Add();
            IDTSParameterBinding parameterBinding = sourceEntitySql.ParameterBindings.GetBinding(0);
            parameterBinding.DtsVariableName = &quot;User::AddressId&quot;; //Global variable
            parameterBinding.ParameterDirection = ParameterDirections.Input;
            parameterBinding.DataType = (int)System.Data.OleDb.OleDbType.VarChar;             parameterBinding.ParameterName = &quot;0&quot;;
            parameterBinding.ParameterSize = 255;

            sourceEntitySql.ResultSetBindings.Add();
            IDTSResultBinding resultBinding = sourceEntitySql.ResultSetBindings.GetBinding(0);
            resultBinding.ResultName = &quot;commonEntity&quot;;
            resultBinding.DtsVariableName = &quot;User::City&quot;;

            pkg.SaveToFile(&quot;GenericCommonToLoadPackage.dtsx&quot;);
            pkg.Execute();</description>
		<content:encoded><![CDATA[<p>Hi, I am using EzAPI to generate SSIS package with a Execute script task followed by a Data flow transformation. I am getting error while assigning connection to SQL task, I believe ez execute sql task host is unable to cast to ExecuteSQLTask object. b.t.w<br />
ResultSetBindings property is not present by default, I manually changed the EzExecSqlTask code to expose IDTSResultBindings.  Here is my code in Main function of a console application.</p>
<p>EzPackage pkg = new EzPackage();<br />
//Create EzConnection and add it to package connections<br />
EzConnectionManager ezConn = AddEzConnection(pkg, &#8220;OLEDB&#8221;, @&#8221;.\SQLEXPRESS&#8221;, &#8220;AdventureWorks&#8221;);</p>
<p>EzExecSqlTask sourceEntitySql = new EzExecSqlTask(pkg);<br />
            sourceEntitySql.Name = &#8220;sourceEntitySql&#8221;;<br />
            sourceEntitySql.Connection = ezConn; //Here is where exception occurs<br />
            sourceEntitySql.SqlStatementSourceType = SqlStatementSourceType.DirectInput;<br />
            sourceEntitySql.ResultSetType = ResultSetType.ResultSetType_SingleRow;<br />
            sourceEntitySql.SqlStatementSource = &#8220;select City from	[Person].[Address] where	AddressID=?&#8221;;<br />
            sourceEntitySql.BypassPrepare = true;</p>
<p>            sourceEntitySql.ParameterBindings.Add();<br />
            IDTSParameterBinding parameterBinding = sourceEntitySql.ParameterBindings.GetBinding(0);<br />
            parameterBinding.DtsVariableName = &#8220;User::AddressId&#8221;; //Global variable<br />
            parameterBinding.ParameterDirection = ParameterDirections.Input;<br />
            parameterBinding.DataType = (int)System.Data.OleDb.OleDbType.VarChar;             parameterBinding.ParameterName = &#8220;0&#8243;;<br />
            parameterBinding.ParameterSize = 255;</p>
<p>            sourceEntitySql.ResultSetBindings.Add();<br />
            IDTSResultBinding resultBinding = sourceEntitySql.ResultSetBindings.GetBinding(0);<br />
            resultBinding.ResultName = &#8220;commonEntity&#8221;;<br />
            resultBinding.DtsVariableName = &#8220;User::City&#8221;;</p>
<p>            pkg.SaveToFile(&#8220;GenericCommonToLoadPackage.dtsx&#8221;);<br />
            pkg.Execute();</p>
]]></content:encoded>
	</item>
</channel>
</rss>

