private static void InitializeComponent(IDTSComponentMetaData100 cmd, ConnectionManager cm) { try { CManagedComponentWrapper cmcw = cmd.Instantiate(); cmd.RuntimeConnectionCollection[0].ConnectionManager = Microsoft.SqlServer.Dts.Runtime.DtsConvert.GetExtendedInterface(cm); cmd.RuntimeConnectionCollection[0].ConnectionManagerID = cm.ID; // aquire the runtime connection to the designtime instance of the component. cmcw.AcquireConnections(null); cmcw.ReinitializeMetaData(); cmd.RemoveInvalidInputColumns(); cmcw.ReleaseConnections(); } catch (Exception e) { Console.WriteLine("There is a problem with the connection manager {0}", cm.Name); Console.WriteLine("More than likely it could not connect to the database and reinitialize the correct columns"); Console.WriteLine("Make sure you have the ability to connect and that the connection managers in the template package are correct"); Console.WriteLine("Error message is below:"); Console.WriteLine(e.Message); System.Environment.Exit(0); } }
/// <summary> /// Removes invalid input columns in SSIS /// </summary> public void CleanUpInputCollection() { ComponentRef.RemoveInvalidInputColumns(); }