Hi,
I am trying a sample SSIS pakcage to fetch data from ADO.Net source and store Catch Transfrom. I tried with controls it is working fine. But when i try to do same thing using code. I was not able to connect the ADO.Net source and Catch Transfrom control. i am getting Error: Exception from HRESULT: 0xC0048004
Am i missing some thing?
using BI i was able to create the Cache Connection manager and Cach Transform. But using code i am not sure how to add it. Is it cause of the issue? If so how can i add it?
private void AddIndustryTempDataFlow(Package pkg) { Executable et = pkg.Executables.Add("STOCK:PipelineTask"); TaskHost thMainPipe = et as TaskHost; MainPipe dataFlowTaskTempTable = thMainPipe.InnerObject as MainPipe; IDTSComponentMetaData100 source= GetIndustryInfoSource(pkg, dataFlowTaskTempTable); IDTSComponentMetaData100 destination = AddCacheTransform(dataFlowTaskTempTable); CreateReleation(dataFlowTaskTempTable,source, destination); //****************Map the column between source and destination Start ************** // Create the design-time instance of the destination. CManagedComponentWrapper destDesignTime = destination.Instantiate(); // The ProvideComponentProperties method creates a default input. destDesignTime.ProvideComponentProperties(); // Get the destination's default input and virtual input. IDTSInput100 input = destination.InputCollection[0]; IDTSVirtualInput100 vInput = input.GetVirtualInput(); // Iterate through the virtual input column collection. foreach (IDTSVirtualInputColumn100 vColumn in vInput.VirtualInputColumnCollection) { // Call the SetUsageType method of the destination // to add each available virtual input column as an input column. destDesignTime.SetUsageType( input.ID, vInput, vColumn.LineageID, DTSUsageType.UT_READONLY); } //****************Map the column between source and destination End ************** // Verify that the columns have been added to the input. foreach (IDTSInputColumn100 inputColumn in destination.InputCollection[0].InputColumnCollection) System.Windows.Forms.MessageBox.Show (inputColumn.Name); } private void CreateReleation(MainPipe dataFlowTaskTempTable,IDTSComponentMetaData100 source ,IDTSComponentMetaData100 destination) { // Create the path. IDTSPath100 path = dataFlowTaskTempTable.PathCollection.New(); path.AttachPathAndPropagateNotifications(source.OutputCollection[0], destination.InputCollection[0]); } private IDTSComponentMetaData100 AddCacheTransform(MainPipe dataFlowTaskTempTable) { Application application = new Application(); PipelineComponentInfos componentInfos = application.PipelineComponentInfos; foreach (PipelineComponentInfo componentInfo in componentInfos) { System.Windows.Forms .MessageBox.Show (componentInfo.Name + "\t" + componentInfo.CreationName); } // Add Cache tranform component to data flow task IDTSComponentMetaData100 componentSource = dataFlowTaskTempTable.ComponentMetaDataCollection.New(); componentSource.Name = "IndustryCacheTransform"; componentSource.ComponentClassID = "DTSTransform.Cache.1"; return componentSource; } private IDTSComponentMetaData100 GetIndustryInfoSource(Package pkg, MainPipe dataFlowTaskTempTable) { // The Application object will be used to obtain the CreationName // of a PipelineComponentInfo from its PipelineComponentInfos collection. Application app = new Application(); //foreach (object a in app.PipelineComponentInfos) //{ // System.Windows.Forms.MessageBox.Show(a.ToString()); //} // Add a first ADO NET source to the data flow. // The CreationName property requires an Application instance. IDTSComponentMetaData100 compRSExecutionIndustryListSource = dataFlowTaskTempTable.ComponentMetaDataCollection.New(); compRSExecutionIndustryListSource.Name = "RSExecutionIndustryListSource"; compRSExecutionIndustryListSource.ComponentClassID = typeof(Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter).AssemblyQualifiedName; // Get the design time instance of the component. CManagedComponentWrapper instance = compRSExecutionIndustryListSource.Instantiate(); // Initialize the component instance.ProvideComponentProperties(); // Specify the connection manager. if (compRSExecutionIndustryListSource.RuntimeConnectionCollection.Count > 0) { compRSExecutionIndustryListSource.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(pkg.Connections["RSExecutionLogConnection"]); compRSExecutionIndustryListSource.RuntimeConnectionCollection[0].ConnectionManagerID = pkg.Connections["RSExecutionLogConnection"].ID; } // Set the custom properties. instance.SetComponentProperty("AccessMode", 2); instance.SetComponentProperty("SqlCommand","SELECT EDWG.ENGID,PD.PARTITION_ID AS PartitionID,EDWG.LocalEngagementID AS LocalEngID FROM RSEXECUTIONLOG.DBO.EngDetails_WGServers EDWG with(nolock) " +"INNER JOIN RSEXECUTIONLOG.DBO.ENGMETADATA EM ON EDWG.ENGID=EM.ENGBACKUPID " +"INNER JOIN RSEXECUTIONLOG.DBO.PARTITION_DETAILS PD ON EM.INDUSTRY=PD.INDUSTRY_ID " +"WHERE EM.BatchID =5 AND EDWG.SQLServerName='edmsrv02\\eauditdw' and DatabaseName='V2FSAJuly8' and SchemaName='AUD166' "); // Reinitialize the metadata. instance.AcquireConnections(null); instance.ReinitializeMetaData(); instance.ReleaseConnections(); return compRSExecutionIndustryListSource; }
saravanakumar