Unable to read object variable in ssis -


need guys. came across problem while developing package client. saving result set of sql task in user variable (object) , trying access in various script tasks. scope of variable set package level. when use below code, able retrieve value of in script task of s.container , if use same code in script task of s.container2, unable to. in later, 'dt' shows headers , not data.

any reason particular behavior.? missing ?

sql task code -----------

select * dimproduct 

script task code -----------

 datatable dt = new datatable();  datarow row = null;  oledbdataadapter oleda = new oledbdataadapter();  oleda.fill(dt, dts.variables["variable"].value);     foreach (datarow row_ in dt.rows)      {        row = row_;      } 

enter image description here

edit :: following code doesn't work.

variables lockedvariables = null;             dts.variabledispenser.lockforwrite("user::variable");             dts.variabledispenser.getvariables( ref lockedvariables);             object a;              a= lockedvariables["user::variable"].value;             lockedvariables.unlock();             datatable dt = new datatable();             datarow row = null;             oledbdataadapter oleda = new oledbdataadapter();             oleda.fill(dt, a);             foreach (datarow row_ in dt.rows)             {                 row = row_;              } 

are sure haven't accidentally declared variable twice, once scope of package, , once scope of first sequence container?

edit: calling fill seems clear source results, should demonstrate:

    datatable dt1 = new datatable();     oledbdataadapter oleda = new oledbdataadapter();     oleda.fill(dt1, dts.variables["results"].value);     foreach (datarow row_ in dt1.rows)     {         messagebox.show(row_[0].tostring());     }      //try , fill same data adapter     datatable dt2 = new datatable();     oleda.fill(dt2, dts.variables["results"].value);      foreach (datarow row_ in dt2.rows)     {         //this never hit         messagebox.show(row_[0].tostring());     }    

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -