question

balanarasimhac-1495 avatar image
0 Votes"
balanarasimhac-1495 asked Monalv-msft edited

Non-invocable member 'ScriptObjectModel.Variables' cannot be used like a method in SSIS script task

Hi Team,
Have small set of code as show in bellow.

// TODO: Add your code here
MessageBox.Show(Dts.Variables["USER::BookingRefResult"].Value.ToString());

When am trying to debug this script task am getting bellow error

Severity Code Description Project File Line Suppression State
Error CS1955 Non-invocable member 'ScriptObjectModel.Variables' cannot be used like a method. ST_295b44f56f3e44d4a8f3ec535aa3d296 C:\Users\AppData\Local\Temp\2\Vsta\SSIS_ST150\VstafJtZCK6UokOavLxJonF_4A\VstasD6LoclKEESpAUJBeCXMGw\ScriptMain.cs 94 Active


When am trying to save this script task am getting bellow error
Scripts contained in the package have compilation error. Do you want to save changes?

Please help on this.

sql-server-integration-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Monalv-msft avatar image
0 Votes"
Monalv-msft answered Monalv-msft edited

Hi @balanarasimhac-1495 ,

1.Please check if you add variable in the Script Task.
74725-scripttask1.png

2.Please set breakpoint in the script of the Script Task.
The following link will be helpful:
Script Task Debugging in SQL Server Integration Services (SSIS)

Best regards,
Mona


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




scripttask1.png (18.5 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @balanarasimhac-1495 ,

May I know if you have anything to update?

Best regards,

Mona

0 Votes 0 ·
YitzhakKhabinsky-0887 avatar image
0 Votes"
YitzhakKhabinsky-0887 answered YitzhakKhabinsky-0887 edited

Hi @balanarasimhac-1495,

SSIS packages variable names are case-sensitive.

That's why in your source code line:

 MessageBox.Show(Dts.Variables["USER::BookingRefResult"].Value.ToString());

the variable name shall be User::BookingRefResult instead of the USER::BookingRefResult
You would need to check the varaible name in the Variables pane outside of the SSIS Script Task editor.

All this is in addition to what Mona already pointed out in her answer.

Before using variables in your script (i.e. before clicking on 'Edit Script...' button), select variables to be used in your script in 'ReadOnlyVariables' or in 'ReadWriteVariables'.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.