Hello,
we wrote a plugin to support us in cloning ports including all attached provided/required interfaces and all connections bound to that port. This is working fine on some PCs but on some others not and ends up with following error message:
"Exception occurred: ADODB.Fields [-2146825023]
Item cannot be found in the collection corresponding to the requested name or ordinal. "
So far we found that this is only raised after calling the Update() function of a newly created connector (and only for the object of type connector). For all other items, i.e. the port element and the interface elements, the creation is successful without any error.
The implementation looks like following:
EA.Element parentElement;
EA.Element newPort;
parentElement = aRepositroy.GetElementByID(portToClone.ParentID);
// create new port
newPort = (EA.Element) parentElement.Elements.AddNew(portToClone.Name + "_CLONE", portToClone.Type);
try { newPort.Update(); }
catch { Log("Error occurred: " + newPort.GetLastError()); }
parentElement.Elements.Refresh();
// take over the connectors
foreach (EA.Connector connectorToClone in portToClone.Connectors)
{
EA.Connector newConnector;
newConnector = (EA.Connector) newPort.Connectors.AddNew("", connectorToClone.Type);
newConnector.SupplierID = connectorToClone.SupplierID;
if (portToClone.ElementID == connectorToClone.ClientID)
{
newConnector.SupplierID = connectorToClone.SupplierID;
}
else
{
newConnector.SupplierID = connectorToClone.ClientID;
newConnector.Direction = "Destination -> Source";
}
try
{
/*
while executing this call we receive the expection:
ADODB.Fields [-2146825023]
Item cannot be found in the collection corresponding to the requested name or ordinal.
*/
newConnector.Update();
}
catch
{
Log("Exception occurred: " + newConnector.GetLastError());
}
newPort.Connectors.Refresh();
}
Our EA model is located on an OracleDB server and we are using Oracle Client 11gR2 (exact same version 11.2.0.32 on all machines).
Does anybody know how we can find out what is causing this error? (Since it only occurs on some machines)
Thank you!
Best Regards
Markus