Share via

SSIS script task error with VB

Anonymous
2017-04-26T20:36:33+00:00

the script task in control flow component shows below error every time it run.

the script language  selected is VB 2015 and is basic -connects to sql server and reads table as below-

 Dim FilePath As String = "c:\temp\cust.txt"

        Dim Writer As StreamWriter = New StreamWriter(FilePath)

        Dim Connection As String = "DataSource=<>;Initial Catalog=<>;Integrated Security=SSPI;"

        Dim Query As String = "SELECT * FROM CUSTOMER"

        Dim con As SqlConnection = New SqlConnection(Connection)  'TO ESTABLISH THE CONNECTION

        Dim adp As SqlDataAdapter = New SqlDataAdapter(Query, con) 'TO EXECUTE THE QUERY

        Dim ds As DataSet = New DataSet()               'TO INITIALIZE THE APPLICATION BUFFER

        adp.Fill(ds)                                    'TO LOAD DATA FROM DATA SOURCE TO APPLICATION

        With ds.Tables(0)                                'TO ITERATE THRU EACH TABLE IN ABOVE DATASET

            For R As Integer = 0 To .Rows.Count - 1          'TO ITERATE FOR EACH ROW

                For C As Integer = 0 To .Columns.Count - 1      'TO ITERATE FOR EACH COLUMN

                    Writer.WriteLine("{0} : {1}", .Columns(C).ColumnName, .Rows(R)(C))

                Next C

                Writer.WriteLine(" ********************************************* ")

            Next R

        End With

        Dts.TaskResult = ScriptResults.Success

below is the error-

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)

   at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()

Location of 2016 installed is - C:\Program Files (x86)\Microsoft SQL Server\2016\

Thanks

suneetha

Windows for home | Previous Windows versions | Apps

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2017-04-27T08:42:23+00:00

Hello Suneetha,

This kind of issue is more complex than what is normally posted here in the Community. We suggest that you post your query in our TechNet Forum for better assistance.

Best Regards.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful