1

I have a SSIS package to perform incremental processing of the cube. In the sequence container in this package, we have a script task to count the number of rows.

enter image description here

and the code in script task is as follows :

    public void Main()
    {
        string connectionString = "Data Source=localhost;PROVIDER=MSOLAP;Impersonation Level=Impersonate;Catalog=EcovaPlatform";
        connectionString = connectionString.Replace("localhost", Dts.Variables["User::CubeServer1"].Value.ToString()).Replace("EcovaPlatform", Dts.Variables["User::CubeName1"].Value.ToString());

        string queryString = "evaluate row(\"count\", countrows(BillDetail))";
        AdomdConnection connection = new AdomdConnection(connectionString);

        connection.Open();
        AdomdCommand cmd = new AdomdCommand(queryString);
        cmd.Connection = connection;
        using (var reader = cmd.ExecuteReader())
        {
            while (reader.Read())
            {
                Dts.Variables["CubeBillDetailRowCount1"].Value = Convert.ToInt64(reader[0]);
            }
        }
        Dts.TaskResult = (int)ScriptResults.Success;

But every once in a while, this script task(here I am assuming its the script task) fails. It throws out the following error:

Source Name: Cube Table RowCount Error Code: 1 Error Description: Exception has been thrown by the target of an invocation.

Now I dont know how to fix this issue. So I am turning to you good folks, to guide me in the right direction. If somebody wants to look at the XMLA script, I can post that as well. Thanks.

billinkc
  • 59,250
  • 9
  • 102
  • 159
Dennyc
  • 63
  • 12
  • 3
    Your best bet is to add some error handling to your script to get a better view into what error you are actually encountering. The "Exception has been thrown by the target of an invocation" error is a catch all in SSIS, and a try catch will grab what's actually happening. – Will In The World Jan 26 '16 at 22:11
  • you mean add that into the script task itself? or do I create a separate task for that? – Dennyc Jan 27 '16 at 17:31

0 Answers0