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.StackOverflowExcep tion' occurred in mscorlib.dll
public DataTable Recurssive(string NewWduserId, string WduserId, DataTable currentTeam, DataTable dtFinal, int HierachyId)
{
DataRow[] currentTeam1 = currentTeam.Select("Wduser Id = '" + WduserId + "'");
string TM = string.Empty;
if (currentTeam1.Length > 0)
{
if (WduserId.Trim() != Convert.ToString(currentTe am1[0]["Su perVisor"] ).Trim())
{
DataRow[] dr = currentTeam.Select("Superv isor ='" + Convert.ToString(currentTe am1[0]["Su perVisor"] ) + "'");
if (dr.Length > 0)
{
DataRow drn = dtFinal.NewRow();
DataRow[] drWd = currentTeam.Select("Wduser Id = '" + 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"].ToStri ng(), currentTeam, dtFinal, HierachyId);
}
}
}
return dtFinal;
}
What's wrong going on?
I have a function which is throwing StackOverflowException.
t thorws message,
StackOverflowException was unhandled.
An unhandled exception of type 'System.StackOverflowExcep
public DataTable Recurssive(string NewWduserId, string WduserId, DataTable currentTeam, DataTable dtFinal, int HierachyId)
{
DataRow[] currentTeam1 = currentTeam.Select("Wduser
string TM = string.Empty;
if (currentTeam1.Length > 0)
{
if (WduserId.Trim() != Convert.ToString(currentTe
{
DataRow[] dr = currentTeam.Select("Superv
if (dr.Length > 0)
{
DataRow drn = dtFinal.NewRow();
DataRow[] drWd = currentTeam.Select("Wduser
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"].ToStri
}
}
}
return dtFinal;
}
What's wrong going on?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER