OLE DB COMMAND Programming Help
Could some one please help in coding a OLE DB Command, to fire a stored procedure which takes 2 parameter's Help me in the coding, by which I should be able to fire a SP that takes 2 parameters, by mapping 2 feilds from the source table to the SP parameter's The Below sample fires a SP without any parameter's ConnectionManager cm = package.Connections.Add("OLEDB"); cm.Name = "OLEDBConnection"; cm.ConnectionString = "Data Source=.;Initial Catalog=AdventureWorks;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Auto Translate=False;"; // Create the source component. IDTSComponentMetaData90 component = dataFlow.ComponentMetaDataCollection.New(); component.Name = "OLEDBSource"; component.ComponentClassID = "DTSAdapter.OleDbSource"; // Get the design time instance of the component. CManagedComponentWrapper instance = component.Instantiate(); // Initialize the component instance.ProvideComponentProperties(); // Specify the connection manager for Source. if (component.RuntimeConnectionCollection.Count > 0) { component.RuntimeConnectionCollection[0].ConnectionManagerID= package.Connections["OLEDBConnection"].ID; component.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(package.Connections["OLEDBConnection"]); } // Set the custom properties. instance.SetComponentProperty("AccessMode", 2); instance.SetComponentProperty("SqlCommand", "Select * from HumanResources.Employee"); // Reinitialize the metadata. instance.AcquireConnections(null); instance.ReinitializeMetaData(); instance.ReleaseConnections(); IDTSComponentMetaData90 m_SQLCommand = null; m_SQLCommand = dataFlow.ComponentMetaDataCollection.New(); m_SQLCommand.ComponentClassID = "DTSTransform.OLEDBCommand.1"; IDTSDesigntimeComponent90 oledbDesignTime = m_SQLCommand.Instantiate(); oledbDesignTime.ProvideComponentProperties(); if (m_SQLCommand.RuntimeConnectionCollection.Count > 0){m_SQLCommand.RuntimeConnectionCollection[0].ConnectionManagerID = package.Connections["OLEDBConnection"].ID; m_SQLCommand.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(package.Connections["OLEDBConnection"]);} oledbDesignTime.SetComponentProperty("SqlCommand", "Exec Test");
January 18th, 2006 2:25pm

After many years there's finally an answer to this question ;) Just in case someone stumbles upon this question (and looking for an answer to it): have a look at my answer in Issue while programmatically Slowly Chaging Dimension. best regards, Gerald
Free Windows Admin Tool Kit Click here and download it now
November 27th, 2010 5:10pm

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

Other recent topics Other recent topics