October 20, 2009 at 10:52 am
When my ControlFlow is executed I need to read which value has my connection string for assigning to a global variable
Thanks a lot for you help
Javier
October 20, 2009 at 2:50 pm
Use a script task. Include the variable you want to assign the connection string to on the ReadWriteVaribles property on the Script tab of the Script task Editor. In your script include a line like
varConnectionString = Dts.Connections.Item("your connection manager name").ConnectionString
The password is not saved in this connection string even if you have checked this option in the Connection Manager properties. You'll have to append it explicitly to your variable.
HTH
October 20, 2009 at 3:18 pm
I created the variable outside, public so when I create the Task Script in the field ReadWriteVariables I can see it and I pick it up.
Then in the Tab Script inside the Task Script I wrote the sentence you gave me
Public Sub Main()
varConnectionString as string
varConnectionString = Dts.Connections.Item("SQL_NCDW_Configuration").ConnectionString
But I received this error: Error at Script Task: The binary code for the script is not found. Please open the script in the designer by clicking Edit Script button and make sure it builds successfully.
Error at Script Task: There were errors during task validation.
October 20, 2009 at 3:26 pm
If you have followed the suggestion in the error message you posted and STILL are getting the error then you have a syntax or other error in your script preventing compilation and production of the binary code. Open your script and view the Error List. There should be some info there to help you resolve your error.
October 20, 2009 at 3:30 pm
oh I forgot to show you how to assign a value to an SSIS variable in code:
Dts.Variables("your SSIS variable").Value = varConnectionString
I'm no sure what you meant when you said you were using an outside, public variable.
October 20, 2009 at 3:49 pm
Thanks so much, now working fine
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply