variables - SSIS Element cannot be found in a collection error - but I have them all listed -


i'm getting persistent error, "the element cannot found in collection. error happens when try retrieve element collection on container during execution of package , element not there".

i've checked, double , triple-checked variable listings in read , read-write variables in script task. i've debugged death , gotten input programmer here couldn't spot issue either. i've researched no end. see wrong code:

script task code:

public sub main()     '     ' add code here     '     dts.variables("user::strmailbody").value = "thank submission. convenience, including last 4 of hicn# , name on application(s) have received* you." _                                                 & vbnewline & vbnewline & "here following: " & vbnewline & vbnewline     dts.variables("user::strmailbody").value = dts.variables("user::strmailbody").value.tostring() & vbnewline & dts.variables("user::strlisting").value.tostring()     dts.variables("user::strmailbody").value = dts.variables("user::strmailbody").value.tostring() & vbnewline & vbnewline & dts.variables("user::strfooter").value.tostring()     if left(dts.variables("user::stragentid").value, 2) = "tx"         dts.variables("user::strsubject").value = "acme health plans confirmation:  total "     else         dts.variables("user::strsubject").value = "acme2 baptist health plans confirmation:  total "     end if     dts.variables("user::strsubject").value = dts.variables("user::strsubject").value.tostring() & dts.variables("user::lngcountagent").value.tostring() & "   " & "[restricted: confidential]"     dts.variables("user::datesent").value = now()     dts.variables("user::usersent").value = "ssis"     dts.taskresult = scriptresults.success end sub 

for else struggling issue resolution me follows: (note not using user:: when getting variable values within script task)

  • on package properties hadn't included variables readonlyvariables

you'll need set newly added variables follows:

  1. right click on package , select edit
  2. in script section click on readonlyvariables or readwritevariables (depending on how want variables behave)
  3. check check-box beside variables wish use in script task
  4. click ok save changes

hope helps


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

jquery - Keeping Kendo Datepicker in min/max range -