简体   繁体   中英

How to add parameters to Oledb Source in ssis programmatically

I am creating an ssis package which contains an OLE DB Source.

The OLE DB Source component execute SP is:

EXEC [dbo].[USP_GetCustomerEtlSourceDetailRecordSet] @OrganizationName=?,@SourceRunID=?

How do I create parameters using C# code to pass to the above SP?

I tried this, and it's not working, how do I map "@OrganizationName" parameter which is Project Parameter ?

Guid variableGuid = new Guid(proj.Parameters["OrganizationName"].ID);
Guid SourceRunID = new Guid(Parent_ETLSourceRunId.ID);
String Parent_ETLSourceRunId1 = @"""@OrganizationName"",{" + variableGuid.ToString().ToUpper() + @"}" + ";" + @"""@SourceRunID"",{" + SourceRunID.ToString().ToUpper() + @"};""";
srcDesignTime.SetComponentProperty("ParameterMapping", Parent_ETLSourceRunId1);

This is what l did that to pass parameters to stored procedure. Dragged Execute SQL task to the designer pane, below is the SQL Query, l have used. SQL查询

Next step is to go to the 'Parameter Mapping' section of the task. I clicked on the 'Add' button, in the variable column there is a pull down list, of all the available variables.
从列表中选择变量

Note the variable value is being passed into the stored proceedure so the direction is 'input'.

These two articles should give you some more information Mapping parameters and results sets Passing parameters using script task

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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