Link to home
Start Free TrialLog in
Avatar of Johny Bravo
Johny Bravo

asked on

StackOverflowException in asp.net

Hi Experts,
I have a function which is throwing StackOverflowException.

t thorws message,
StackOverflowException was unhandled.
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

 public DataTable Recurssive(string NewWduserId, string WduserId, DataTable currentTeam, DataTable dtFinal, int HierachyId)
        {
            DataRow[] currentTeam1 = currentTeam.Select("WduserId = '" + WduserId + "'");
            string TM = string.Empty;
            if (currentTeam1.Length > 0)
            {
                if (WduserId.Trim() != Convert.ToString(currentTeam1[0]["SuperVisor"]).Trim())
                {
                    DataRow[] dr = currentTeam.Select("Supervisor ='" + Convert.ToString(currentTeam1[0]["SuperVisor"]) + "'");
                    if (dr.Length > 0)
                    {
                        DataRow drn = dtFinal.NewRow();
                        DataRow[] drWd = currentTeam.Select("WduserId = '" + NewWduserId + "'");
                        drn["wduserid"] = NewWduserId;
                        drn["empname"] = drWd[0]["empname"];
                        drn["supervisorid"] = dr[0]["supervisor"];
                        drn["supervisorname"] = dr[0]["supervisorname"];
                        drn["designation"] = dr[0]["designationname"];
                        drn["compemailId"] = dr[0]["compemailId"];
                        drn["StructureId"] = HierachyId;
                        dtFinal.Rows.Add(drn);
                        HierachyId = HierachyId + 1;
                        Recurssive(NewWduserId, dr[0]["SuperVisor"].ToString(), currentTeam, dtFinal, HierachyId);
                    }
                }
            }
            return dtFinal;
        }


What's wrong going on?
ASKER CERTIFIED SOLUTION
Avatar of robasta
robasta
Flag of Zimbabwe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Johny Bravo
Johny Bravo

ASKER

Thanks for the guidance.The issue is resolved