<%@ Language=VBScript%> <% dim strpagecode strpagecode= "FAIRG01" %> Untitled Document <% set rs = Server.CreateObject("ADODB.RECORDSET") set rs1 = Server.CreateObject("ADODB.RECORDSET") 'Before inserting the record for a Product Category, it has to be checked for duplicate 'Product Id / code. strQry = " select * from toberemoved " set rs = ObjConn.Execute(strQry) %> <% do while not rs.EOF strParentNames = ReturnParentValue(rs("ParentId")) %> <% rs.MoveNext loop %> <% function ReturnParentValue(nmParentId) 'Before inserting the record for a Product Category, it has to be checked for duplicate 'Product Id / code. 'nmParentId = -1 strNames = "" do while not nmParentId = 0 strQry = " select a.name,a.id, a.parentid from toberemoved a where a.id = " & nmParentId set rs1 = ObjConn.Execute(strQry) nmParentId = rs1("ParentId") strNames = rs1("name") & "-->" & strNames loop ReturnParentValue = strNames end function %>
id  name 
<%=rs("id")%>  <%=strParentNames%>--<%=rs("Name")%>