StackOverflowException in

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;
                        HierachyId = HierachyId + 1;
                        Recurssive(NewWduserId, dr[0]["SuperVisor"].ToString(), currentTeam, dtFinal, HierachyId);
            return dtFinal;

What's wrong going on?
Johny BravoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

That error is usually due to an infinite loop or an endless recursion. Check the condition for calling your recurssive procedure.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You do not modify DataTable currentTeam inside this method.
So, all conditions are allways true and you allways add new row to dtFinal. Infinitely.
Johny BravoAuthor Commented:
Thanks for the guidance.The issue is resolved
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.