naming data flow components programatically
I hope this is easy for someone. I've built a package using the SSIS object model and I want to use the union operator. My problem is that when I add two sources to my data flow task I get a duplicate name error because they are both named OLE DB Source. I can't seem to figure out how to set the name property for a data flow component. I've been able to do it for the package, sequence containers, and data flow tasks, just not the components inside the data flow task. This is what I've tried to do to create and set the component properties: Dim srcSourceRecords As IDTSComponentMetaData100 = dataFlowTask.ComponentMetaDataCollection.New() srcSourceRecords.Name = "My new name" srcSourceRecords.Description = "My source component description" srcSourceRecords.ComponentClassID = "DTSAdapter.OleDbSource.2" Obviously this is not where I set the name of my component because when I open my SSIS package the source components just default back to "OLE DB Source". Any help is appreciated.JAM
May 27th, 2011 12:54pm

Must be .Name as per http://ssisbi.com/building-ssis-packages-programmatically-part-8/: // Create a package PackageBuilder pb = new PackageBuilder(); Package pkg = pb.CreatePackage(); //Add connections to the package ConnectionManager flatFileConnMgr, oledbConnMgr; oledbConnMgr = pb.AddConnection(pkg, pb.OLEDB); ... e.g. conn string, etc. //Set NAME oledbConnMgr.Name = "OLEDB Connection"; Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2011 1:08pm

Your example adds a connection manager connection to the package. That seems to work just fine. My problem is in setting the name property of an ole db source component inside a data flow task. I'll try and rebuild the examples in your link, but I don't see that example actually setting a name for the data flow source either.JAM
May 27th, 2011 1:30pm

Create outside and reuse from inside the DFTArthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2011 1:32pm

I'm sorry. I don't understand what you mean. How do create the source outside the data flow task?JAM
May 27th, 2011 1:40pm

Create your connection managers as in the example. Use them in the DFT task after they are created.Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2011 1:56pm

But it's not the connection managers I have a problem with. In my package I have one connection manager connection called "Source". I have one data flow task and in that data flow task I am creating two data flow sources, both of which use the same connection manager "Source". It's the two data flow sources in the same dft that I can't set the name property on. Are you suggesting that I create two different connection manager connections even though the actual connection information is the same? JAM
May 27th, 2011 2:08pm

Yes. And not sure why you cannot re-use the existingArthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2011 2:21pm

I need two distinct data flow sources in the same task in order to use the union component. I don't understand why I need to create two connection managers for that. If I'm using BIDS I build one connection manager, I build my task, I build data flow source 1 in the task, then data flow source 2 in the task, then run them through the union component, I thought I could do the same thing with the object model, but I can't get two sources in the same DFT because they have the same name. Thanks for trying to help though. JAM
May 27th, 2011 2:32pm

You shouldnt have to, and I don't know why ArthurZ is persisting in misunderstanding what you're trying to say. The link he provided leads to a very good resource - click back to "part 7", and you'll see that there's a Name property on the OLE DB Source. You should just have to change that. Talk to me now on
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2011 6:04pm

Thank you for responding. It's that very name property I'm having a problem with. No matter what I set that property to, the name in the package is always "OLE DB Source". I have not seen the article you provided a link to so I'll read through it, maybe I can find my mistake. JAM
May 31st, 2011 10:20am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics