Reputation: 37
I'm trying to create a new data flow using Microsoft.SqlServer.Dts.Pipeline.Wrapper I was inspired by the following helper : Learn Microsoft And other posts on stackoverflow. Unfortunately, it doesn't work :
`
Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package();
Microsoft.SqlServer.Dts.Runtime.Executable e = package.Executables.Add("STOCK:PipelineTask");
Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = e as Microsoft.SqlServer.Dts.Runtime.TaskHost;
MainPipe dataflowTask = thMainPipe.InnerObject as MainPipe;
IDTSComponentMetaData100 cmp = dataflowTask.ComponentMetaDataCollection.New();
cmp.ComponentClassID = "DTSAdapter.OleDbSource";
CManagedComponentWrapper dtSource = cmp.Instantiate();
dtSource.SetComponentProperty("SqlCommand", "select * from Production.Products");
` The last command generate an exception :
"Exception de HRESULT : 0xC0048021"} System.Runtime.InteropServices.COMException
I can't understand why, especially since this very simple code is a copy/paste from the Microsoft site
My config : VS 2019 using .NET 4.7 / SQL 2019
At this stage of development, is it necessary to have a connection to the SQL server? (the server is not accessible for the moment) Is my problem here? (I don't understand well because I didn't create a connection in the code)
Upvotes: 0
Views: 452
Reputation: 73
When we migrated SSIS packages from 2014 to 2019, we faced the same issue.
This error basically means the ComponentClassID you are using in the code is not right for the target server version. Review your ClassID from the windows registry under Computer\HKEY_CLASSES_ROOT\DTSAdapter.OleDbSource.* and use the latest available key as the ComponentClassID in your code.
I had to use DTSAdapter.OledbSource.7 and then disable the 'Run64bitRuntime' property on the SSIS Project Properties page.
Upvotes: 1