receive an system.object variable from SSIS and loop on it in foreach parallel loop in C# -


ths code appears works fine here insert add. values listtables. while want assing object variable (user::hosps) ssis (system.object) list (or array) how can done? part:

oledbdataadapter = new oledbdataadapter();      system.data.datatable dt = new system.data.datatable();      a.fill(dt, dts.variables["user::hosps"].value); 

is found online , tryed use values assigns list not values want object.

#region namespaces using system; using system.data; using system.io; using system.threading; using system.threading.tasks; using system.windows.forms; using system.data.sqlclient; using system.data.oledb; using microsoft.sqlserver.dts.runtime; using system.diagnostics; using system.collections.generic; using oracle.dataaccess.client; using oracle.dataaccess.types;  #endregion  namespace st_ef6fc7b20ff94cbfb2587ed23a6520a0 {      [microsoft.sqlserver.dts.tasks.scripttask.ssisscripttaskentrypointattribute]     public partial class scriptmain : microsoft.sqlserver.dts.tasks.scripttask.vstartscriptobjectmodelbase     {          public void main()         {          oledbdataadapter = new oledbdataadapter();          system.data.datatable dt = new system.data.datatable();          a.fill(dt, dts.variables["user::hosps"].value);          foreach (datarow row in dt.rows)         {              tables.add(row.tostring());         }             list<string> tables = new list<string>();              tables.add("abraviv");              tables.add("flimanaviv");              tables.add("bshaviv");              tables.add("levaviv");              tables.add("beeraviv");              tables.add("tiraaviv");              tables.add("shraviv");              tables.add("mazaviv");              tables.add("ntnyaaviv");              tables.add("shmuelaviv");              tables.add("pardesaviv");              tables.add("rishonaviv");          parallel.foreach(tables, table =>         {               sqlconnection myconnection = new sqlconnection();                           myconnection.connectionstring = "data source=vmbi-devdb\\gp;initial catalog=gp;integrated security=true;pooling=false;";              sqldatareader rdr = null;              myconnection.open();              sqlcommand cmd = new sqlcommand("exec mirror_logistic.load_table_from_source " + table, myconnection);              cmd.commandtimeout = 0;               rdr = cmd.executereader();              myconnection.close();                       });             }      #region scriptresults declaration         enum scriptresults         {             success = microsoft.sqlserver.dts.runtime.dtsexecresult.success,             failure = microsoft.sqlserver.dts.runtime.dtsexecresult.failure         };         #endregion     } } 

actually variable user::hosps contains same values assigned tables.add

sorry, got me confused.

do want assign values ur ssis-object list? or want assign ur values c# object?

    public void main()     {      oledbdataadapter = new oledbdataadapter();      system.data.datatable dt = new system.data.datatable();      a.fill(dt, dts.variables["user::hosps"].value);  list<string> myvalues = new list<string>();      foreach (datarow row in dt.rows)     {          myvalues.add(row[0].tostring());     } 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -