I have been working on a solution using CozyRoc components to create a configurable fuzzy lookup process. Beyond the DataFlow Plus with a Fuzzy Lookup control, I am also providing configurations for fuzzy component properties (ex. MaxOutputMatchesPerInput). This has been completed through using a ScriptComponentPlus task using a PackageConnection to the current package. Below is the code that is being used to configure the Fuzzy Lookup properties (this is geared towards the structure of my generic package, and based on advice from Ivan). This seems to work fine in one environment, but in another environment I am receiving a message "Failed to retrieve active package".
This script task is prior to the dynamic data flow using the Fuzzy Lookup. In trying to Debug, my breakpoints do not seem to persist in the Scipt Component Plus editor. Please advise if there is anything that can be looked at to either enable debugging, or even better, resolve this issue.
try
{
ConnectionManager manager = Dts.Connections[this.PackageConnection];
IPackageConnection connection = (IPackageConnection)manager.AcquireConnection(null);
Package p = (Package)connection.GetPackage();
foreach (Executable e in p.Executables)
{
try
{
Microsoft.SqlServer.Dts.Runtime.ForEachLoop fe = (Microsoft.SqlServer.Dts.Runtime.ForEachLoop)e;
foreach (Executable ee in fe.Executables)
{
try
{
TaskHost th = (TaskHost)ee;
MainPipe pipe = (MainPipe)th.InnerObject;
foreach (IDTSComponentMetaData100 o in pipe.ComponentMetaDataCollection)
{
if (o.ComponentClassID == "{E4A5F949-EC93-45AB-8B36-B52936257EC2}")
{
OleDbDataAdapter oleDA = new OleDbDataAdapter();
DataTable dt = new DataTable();
oleDA.Fill(dt, Dts.Variables["ComponentProperties"].Value);
foreach (DataRow dr in dt.Rows)
{
o.CustomPropertyCollection[dr["PropertyName"].ToString()].Value = dr["PropertyValue"].ToString();
}
}
}
}
catch{}
}
}
catch{}
}
Dts.TaskResult = (int)ScriptResults.Success;
}
catch (Exception ex)
{
Dts.Events.FireError(0, "Dynamic Fuzzy", ex.Message, "", -1);
Dts.TaskResult = (int)ScriptResults.Failure;
}