'Dim Countspace
Sub ShowCategoryByParentId(varPid)
Dim Countspace
Countspace = Countspace + 1
Dim strSql,rsC
strSql = "select * from vProCategory where pbCategoryParentId = " & varPid
Set rsC=server.CreateObject("adodb.recordset")
rsC.CursorLocation = 3
rsC.Open strSql,conn,3,3
If rsC.recordcount > 0 Then
Do until rsC.eof
Response.Write("<option value='" & rsC("pbCategoryId") &"'>" & ShowSpace(Countspace) &rsC("pbCategoryName") & "</option>")
Call ShowCategoryByParentId(rsC("pbCategoryId"))
rsC.moveNext
Loop
End If
rsC.Close
End Sub
Function ShowSpace(varNumb)
Dim i,temp
temp = ""
For i=0 to varNumb
temp = " " + temp
Next
ShowSpace = temp
End Function
Sub ShowCategoryByParentId(varPid)
Dim strSql,rsC
strSql = "select * from vProCategory where pbCategoryParentId = " & varPid
Set rsC=server.CreateObject("adodb.recordset")
rsC.CursorLocation = 3
rsC.Open strSql,conn,3,3
If rsC.recordcount > 0 Then
Response.write("<div style='margin-left: 30px;'>")
Do until rsC.eof
Response.Write("" & rsC("pbCategoryName") & "<br>")
Call ShowCategoryByParentId(rsC("pbCategoryId"))
rsC.moveNext
Loop
Response.write("</div>")
End If
rsC.Close
End Sub