Here is something for the people that are working with SSIS
packages on a daily basis.
If you ever worked on
creating SSIS package programatically, maybe you searched how to solve the
problem of adding parameter (SSIS variable) to an OLE DB source (not to sql
task (!)) used with sql command. For example, your OLE DB source sql command is
SELECT * FROM Production.Product WHERE product_type = ?
Of course, ? means parameter, and you want to add a prameter
to an OLE DB source.I've searched alot for the answer, but, though there are
lots of explanations and examples on the Internet about this topic, still I did
not find answer to this one.
The answer is to get the GUID of the package variable which
value you want to assign to be parameter value, and then to set OLE DB
ComponentProperty("ParameterMapping",
@"""ParamName""" + "," +
StringThatContainsVariableGUID + ";"); And that's it! Hope someone
will have to search less for this answer now.