Dilvid
Dilvid

Reputation: 35

Where can I find the PreExecute method in SSIS script component?

I am trying to call a Net.TCP WCF service within my SSIS package. I have set up the script component, changed the .NET Framework to 3.5 in the Service Reference. I am creating the sample package based on the example provided in the below link.

How to Configure an SSIS Package to Access a Web Service using WCF

The link states to override the PreExecute method but I am unable to find the method within the script component in SQL 2008 R2.

The script component in my package begins with the following code:

[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase

However, the example written in the above-mentioned article has the below code:

[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent

I've tried just copying the code across then to fix the relevant references but no where does it contain a reference for UserComponent.

Could someone point out what am I doing wrong here?

Upvotes: 0

Views: 1737

Answers (1)

user756519
user756519

Reputation:

Cause of the issue:

You are using the Script Task available on the Control Flow tab instead of the Script Component transformation available within Data Flow Task.

SSIS 2008 R2 package illustrating the differences:

Create an SSIS package in Business Intelligence Development Studio (BIDS) 2008 R2 and name it as SO_10121670.dtsx.

BIDS will be default display the Control Flow Tab. From the toolbox, drag and drop Script Task and Data Flow Task as shown below.

Control Flow

Double-click Script Task to view the Script Task Editor. On the Script Task Editor, click Script page and then click Edit Script...

Script Task Editor

Integration Services Script Task code editor will open. You will notice that the class ScriptMain inherits from Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase

The example it the MSDN article does not use this Script Task.

Script Task

On the Control Flow tab, double-click Data Flow Task to switch to the Data Flow tab. Drag and drop a Script Component from the Data Flow Transformations section on the Toolbox.

Data Flow Task

When you drag and drop a Script Component, the Select Script Component Type dialog will appear. You have to choose the appropriate one that suits your requirements. This sample sets the type to Source so we can view the script editor. Click OK.

Select Script Component Type

Double-click the Script Component to view the Script Transformation Editor. On the Script Transformation Editor, click Script page and then click Edit Script...

Script Transformation Editor

Integration Services Script Component code editor will open. You will notice that the class ScriptMain inherits from UserComponent. This is the component that you need to use to practice the WCF sample code in the MSDN blog article.

You can see the PreExecute method inside the Script Component code that you have been looking for.

Script Component

Upvotes: 1

Related Questions