programmatically adding OLEDB Source component
I have created an OLEDB source from a SqlCommand successfully when using CManagedComponentWrapper instanceSourceAgg = compSourceAgg.Instantiate(); // Initialize the component instanceSourceAgg.ProvideComponentProperties(); instanceSourceAgg.SetComponentProperty("AccessMode", 2); instanceSourceAgg.SetComponentProperty("SqlCommand", "Select EXTREF as AGG_EXTREF, AGG_CREATED_DATE, AGG_UPDATED_DATE from agg." + sourceSQLObject.Replace("[", "").Replace("]", "").Split('.')[1] + " Order by ExtRef"); Does anyone have an example of using SQL Command from variable? I have created the variable: if (!package.Variables.Contains("ExtractSelection")) { package.Variables.Add("ExtractSelection", false, "User", ""); } package.Variables["ExtractSelection"].Expression = "Select * from agg.tvf" + sourceSQLObject.Replace("[", "").Replace("]", "").Split('.')[1] + "(@[User::BatchID]) Order by ExtRef"; I assume you need to add by using instanceSourceExtract.SetComponentProperty("SqlCommandFromVariable", but cant seem to get the variable added Any help would be appreciated David
December 17th, 2010 6:32am

Not quite sure what you mean by "cant seem to get the variable added. Set AccessMode to 3, and set SqlCommandVariable to ExtractSelection. You should also set the EvaluateAsExpression property to true on your variable, since you are setting an expression. I often find when working with packages in code it is worth saving the package to disk and then opening it in the designer, it is often easier to spot what is wrong that way.http://www.sqlis.com | http://www.konesans.com
Free Windows Admin Tool Kit Click here and download it now
December 17th, 2010 8:11am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics