locked
ADOMD exception "Object is no longer valid" RRS feed

  • Question

  • I'm using ADOMD to get all members of a dimension. I implemented a recursive method and for some reason, this doesn't happen everytime, i get the exception: "Object is no longer valid".

     

     

    public TreeNode GetDimensionHierarchy(ADOMD.CubeDef cube, string pDimensionName, ADOMD.Member pMember)

    {

    TreeNode _rNode, _curNode = null;

    if (pMember == null)

    {

    pMember = cube.Dimensions[pDimensionName].Hierarchies["Periodo"].Levels[0].Members[0];

    }

    _curNode = new TreeNode(pMember.Name, pMember.UniqueName);

    foreach (ADOMD.Member _Member in pMember.Children)

    {

    _rNode = GetDimensionHierarchy(cube, pDimensionName, _Member);

    _curNode.ChildNodes.Add(_rNode);

    }

    return _curNode;

    }

     

     

    The exception is thrown for  parameter function pMember.

     

    Help would be appreciated.

     

    PS:  my project is in asp.net

    tks,

    Luis Silva

     

     

     

    Monday, September 22, 2008 3:44 PM

Answers

  • After digging a lot I got it. I read somewhere that "ADOMD" can be quite unstable, so the solution is to upgrade and use "ADOMD.Net" instead. The "ADOMD.Net" object model is similar to "ADOMD".

     

    My recomendation for anyone that uses "ADOMD" is to download "ADOMD.Net" and install it, then add the reference in VBStudio.

     

     

    Tuesday, September 23, 2008 3:39 PM