DRDuquette
Programmer
Can anyone help me solve the issue below?
I can run my SSIS package in the IDE on my desktop successfully. Also, I can run my package successfully from DOS using a .BAT file that calls the package on the same computer. However, when I try to run the package on other servers I get the following error when the Script Task is executed:
Failed to load task "Script Task", type Microsoft.SQLserver.Tasks.ScriptTask.ScriptTask, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91", The contact information for this task is "".
The C# code for the script task is as follows:
using System;
using System.Data;
using System.Collections.Generic;
using Microsoft.SqlServer.Dts.Runtime;
//using Microsoft.SqlServer.ManagedDts;
using System.Windows.Forms;
namespace ST_2505d5a050044f9e975ce7dc4828ddd8.csproj
{
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
#region VSTA generated code
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
#endregion
/*
The execution engine calls this method when the task executes.
To access the object model, use the Dts property. Connections, variables, events,
and logging features are available as members of the Dts property as shown in the following examples.
To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
To post a log entry, call Dts.Log("This is my log text", 999, null);
To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
To use the connections collection use something like the following:
ConnectionManager cm = Dts.Connections.Add("OLEDB");
cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
To open Help, press F1.
*/
public void Main()
{
string returnVal = "";
string result = "";
string data = Dts.Variables["User::gs_encrypted_pwd"].Value.ToString();
try
{
System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
System.Text.Decoder utf8Decode = encoder.GetDecoder();
byte[] todecode_byte = Convert.FromBase64String(data);
int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
char[] decoded_char = new char[charCount];
utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
result = new String(decoded_char);
returnVal = cleanStrangChar(result.Trim());
Dts.Variables["User::gs_Password"].Value = returnVal;
}
catch (Exception ex)
{
returnVal = "ERROR: " + ex.Message.ToString();
}
Dts.TaskResult = (int)ScriptResults.Success;
}
public string cleanStrangChar(string strVal)
{
string returnVal = "";
char singleChar;
for (int i = 0; i < strVal.Length; i++)
{
singleChar = Convert.ToChar(strVal.Substring(i, 1));
if (!char.IsControl(singleChar))
returnVal += strVal.Substring(i, 1);
}
return returnVal;
}
}
}
I can run my SSIS package in the IDE on my desktop successfully. Also, I can run my package successfully from DOS using a .BAT file that calls the package on the same computer. However, when I try to run the package on other servers I get the following error when the Script Task is executed:
Failed to load task "Script Task", type Microsoft.SQLserver.Tasks.ScriptTask.ScriptTask, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91", The contact information for this task is "".
The C# code for the script task is as follows:
using System;
using System.Data;
using System.Collections.Generic;
using Microsoft.SqlServer.Dts.Runtime;
//using Microsoft.SqlServer.ManagedDts;
using System.Windows.Forms;
namespace ST_2505d5a050044f9e975ce7dc4828ddd8.csproj
{
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
#region VSTA generated code
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
#endregion
/*
The execution engine calls this method when the task executes.
To access the object model, use the Dts property. Connections, variables, events,
and logging features are available as members of the Dts property as shown in the following examples.
To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
To post a log entry, call Dts.Log("This is my log text", 999, null);
To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
To use the connections collection use something like the following:
ConnectionManager cm = Dts.Connections.Add("OLEDB");
cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
To open Help, press F1.
*/
public void Main()
{
string returnVal = "";
string result = "";
string data = Dts.Variables["User::gs_encrypted_pwd"].Value.ToString();
try
{
System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
System.Text.Decoder utf8Decode = encoder.GetDecoder();
byte[] todecode_byte = Convert.FromBase64String(data);
int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
char[] decoded_char = new char[charCount];
utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
result = new String(decoded_char);
returnVal = cleanStrangChar(result.Trim());
Dts.Variables["User::gs_Password"].Value = returnVal;
}
catch (Exception ex)
{
returnVal = "ERROR: " + ex.Message.ToString();
}
Dts.TaskResult = (int)ScriptResults.Success;
}
public string cleanStrangChar(string strVal)
{
string returnVal = "";
char singleChar;
for (int i = 0; i < strVal.Length; i++)
{
singleChar = Convert.ToChar(strVal.Substring(i, 1));
if (!char.IsControl(singleChar))
returnVal += strVal.Substring(i, 1);
}
return returnVal;
}
}
}