Source Component | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Source Component

trying to add a source component programtically.<br /><br />in Script task created a package, added a Data Flow Task and trying add a source component programatically. got the following code from books online… but getting an <font color="red">error</font id="red">… for <font color="red">AcquireConnections</font id="red"><br /><br />Dim SourceComponent As IDTSComponentMetaData90 = dataFlowTask.ComponentMetaDataCollection.New()<br />SourceComponent.Name = "FileSource"<br />SourceComponent.ComponentClassID = "DTSAdapter.ExcelSource.1"<br /><br /><br />’ Get the design time instance of the component.<br />Dim Sourceinstance As CManagedComponentWrapper = SourceComponent.Instantiate()<br /><br />’ Initialize the component.<br />Sourceinstance.ProvideComponentProperties()<br /><br />” Specify the connection manager.<br />If SourceComponent.RuntimeConnectionCollection.Count &gt; 0 Then<br />SourceComponent.RuntimeConnectionCollection(0).ConnectionManager = DtsConvert.ToConnectionManager90(package.Connections(0))<br />End If<br /><br />” Set the custom properties.<br />’Sourceinstance.SetComponentProperty("AccessMode", 2)<br />’Sourceinstance.SetComponentProperty("SqlCommand", "Select * from Production.Product")<br /><br />’ Reinitialize the metadata.<br />Sourceinstance.AcquireConnections(vbNull) — <font color="blue">gettting an error at this line</font id="blue">.<br />Sourceinstance.ReinitializeMetaData()<br />Sourceinstance.ReleaseConnections()<br /><br /><br />Iam very new to DTS, any insight on this is appreciated. thanks in advance.[<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]

Check the references:
http://msdn2.microsoft.com/en-us/library/ms215013
http://msdn2.microsoft.com/en-us/library/ms215061 – overview about generating data flow components.
http://www.microsoft.com/downloads/…68-4991-432A-9D4B-0562DC49992E&displaylang=en – samples to test with. HTH Satya SKJ
Microsoft SQL Server MVP
Contributing Editor & Forums Moderator
http://www.SQL-Server-Performance.Com
This posting is provided �AS IS� with no rights for the sake of knowledge sharing.
]]>