sql server 2012 - exception has been thrown by the target of an invocation. ssis script task -


i have added external dll files in script task. code working when debugging script task code not working when execute ssis package directly without debugging. getting exception has been thrown target of invocation. ssis error in this. can have solution on problem. have registered dll's in gac , restarted machine. still giving me error

i had difficult time finding solution issue (the issue no solution has been posted here @ least couple of times). has vfp oledb data provider blowing in .net when reading dbfs.

apparently, issue stems way vfp allows take digits right side of decimal point , use them on left side. example if column defined n(5,3) should hold numbers 9.999, if don't need 3 decimal places on right side of decimal point, can use space left on digits on left side. column hold 999.9! in case, throws invalidoperationexception. prevents using dataadapter's fill() method read data. work-around, use data reader, build datatable scratch , populate each column, 1 @ time in each row. when exception occurs, insert null value. here's c# 2.0 code:

public datatable getvfpdatatable(string dbffullpath) {   string sqlstring = "select * " + path.getfilename(dbffullpath);   oledbconnection oleconn = new oledbconnection("provider=vfpoledb.1;data source=" +       path.getdirectoryname(dbffullpath) + ";collating sequence=machine;");    oledbcommand olecmd = new oledbcommand(sqlstring, oleconn);   oledbdatareader olereader;   datacolumn col;   datarow row;    datatable dbftable = new datatable();    try   {       oleconn.open();       //bug in vfp ole data adapter blows error        //  "the provider not determine decimal value..."       //  must read data reader row row, column column        olereader = olecmd.executereader();       (int = 0; < olereader.fieldcount; i++)       {           col = new datacolumn(olereader.getname(i), olereader.getfieldtype(i));           dbftable.columns.add(col);       }        while (olereader.read())       {         row = dbftable.newrow();         (int = 0; < olereader.fieldcount; i++)         {           try           {               row[i] = olereader[i];           }           catch (invalidoperationexception)           {             row[i] = dbnull.value;  //work-around vfp oledb provider glitch           }         }          dbftable.rows.add(row);       }    }   catch (exception ex)   {       throw new fileloadexception("error importing vfp file\n" +           ex.message + "\nvfpdataaccess.cs:getvfpdatatable()", dbffullpath);   }     {       oleconn.close();   }    return dbftable; } 

Comments