When Added RowCount programmatically I got Row Count created without Input or Output
RowCountExtract = pipe.ComponentMetaDataCollection.New();
RowCountExtract.Name =
"Row Count Extract";
RowCountExtract.ComponentClassID =
"{150E6007-7C6A-4CC3-8FF3-FC73783A972E}";
CManagedComponentWrapper instance = RowCountExtract.Instantiate();
instance.ReinitializeMetaData();
May 14th, 2012 4:49pm
What input do you expect from the rowcount?
What are you trying to accomplish?
This is how you add DFT components in code: http://msdn.microsoft.com/en-us/library/ms135932.aspxArthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 14th, 2012 4:58pm
Try to create a package which does following (please don't ask why)
1) Reads from OLEDB source
2) Pass it to RowCount to set a variable with row-count value.
So doing following,
IDTSComponentMetaData100 OLEDBSource;
IDTSComponentMetaData100 RowCountExtract;OLEDBSource = pipe.ComponentMetaDataCollection.New();
OLEDBSource.Name = "OLE DB Source";
OLEDBSource.ComponentClassID = "{BCEFE59B-6819-47F7-A125-63753B33ABB7}";
CManagedComponentWrapper instance = OLEDBSource.Instantiate();
instance.ProvideComponentProperties();
if (OLEDBSource.RuntimeConnectionCollection.Count > 0)
{
OLEDBSource.RuntimeConnectionCollection[0].ConnectionManager =
DtsConvert.GetExtendedInterface(p.Connections[0]);
OLEDBSource.RuntimeConnectionCollection[0].ConnectionManagerID =
p.Connections[0].ID;
}
instance.SetComponentProperty("SqlCommand", "SOME SQL");
instance.SetComponentProperty("AccessMode", 2);
instance.AcquireConnections(null);
instance.ReinitializeMetaData();
instance.ReleaseConnections();
RowCountExtract = pipe.ComponentMetaDataCollection.New();
RowCountExtract.Name = "Row Count Extract";
RowCountExtract.ComponentClassID = "{150E6007-7C6A-4CC3-8FF3-FC73783A972E}";
CManagedComponentWrapper instance = RowCountExtract.Instantiate();
instance.ReinitializeMetaData();
IDTSPath100 newPath = pipe.PathCollection.New();
newPath.Name = "DBExtract";
newPath.AttachPathAndPropagateNotifications(OLEDBSource.OutputCollection[0],
RowCountExtract.InputCollection[0]);
This gives me error message "Incorrect Index".
To debug, I saved the package and opened in visual editor and found that RowCount do not have Input or Output port.
Please help me.
Protect and Restore Identity
May 14th, 2012 5:04pm
Based on what I see you decided to code inside a Script task just to get the row count.
This begs a question why, why would not you use the stock RowCount Transformation?Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 15th, 2012 10:47am