DB.mdb veritabanı:
----------------------
ID: Otomatik Sayı
ParentID: Sayı
Kategori: Metin
Kategorilerin Listeleneceği Sayfa: (default.asp)
--------------------------------------
<%
Set baglanti = Server.CreateObject ("ADODB.Connection" )
baglanti.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("DB.mdb" )
%>
<div align="center">
<center>
<%
Set Rs = Server.CreateObject("Adodb.Recordset" )
SQL = "Select * from Tablo where ParentID='0' order by ID Asc"
Rs.Open SQL, baglanti, 1, 3
%>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="300" id="AutoNumber1">
<tr>
<td width="100%"> </td>
</tr>
<%
For t=1 To Rs.RecordCount
If Rs.Eof Then exit for
%>
<tr>
<td width="100%"><a href="Kategori.asp?ID=<%=Rs("ID" ) %>"><font face="Arial" size="2" color="#000000"><%=Rs("Kategori" ) %></font></a></td>
</tr>
<%
Rs.Movenext
Next
Rs.Close
Set Rs = Nothing
%>
</table>
</center>
</div>
Alt Kategorilerin Listeleneceği Sayfa: (kategori.asp)
------------------------------------------
<%
Set baglanti = Server.CreateObject ("ADODB.Connection" )
baglanti.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("DB.mdb" )
%>
<div align="center">
<center>
<%
ID = Request.QueryString("ID" )
Set Rs = Server.CreateObject("Adodb.Recordset" )
SQL = "Select * from Tablo where ParentID='" &ID&"' order by ID Asc"
Rs.Open SQL, baglanti, 1, 3
%>
<%
Sub PrintParents(Cat)
Set rsSelect = Server.CreateObject("Adodb.Recordset" )
If Cat > 0 Then
strSQL = "Select ParentID from Tablo where ID = " & Cat
rsSelect.Open strSQL, baglanti
Set ObjPt = rsSelect("ParentID" )
Pt = ObjPt
rsSelect.Close
PrintParents(Pt)
Else
Response.Write ("<b><a href='default.asp'><font face='Arial' size='2' color='#0066CC'>Anasayfa</font></a></b> " )
End If
strSQL = "Select * from Tablo Where ID = " & Cat
strSQL = strSQL & ""
'Debuggin of SQL
'Response.Write("<br>Get Parent Info" & strSQL & "<br>" )
rsSelect.Open strSQL, baglanti
If Not rsSelect.Eof Then
Set objName = rsSelect("Kategori" )
Set objID = rsSelect("ID" )
'Response.Write ( "<br>" & objID & "-" & objName & "<br>" )
Response.Write ( " <font face='Arial' size='1'>>></font> <a href='Kategori.asp?ID=" & ObjID)
Response.Write ("'><b><font face='Arial' size='2' color='#0066CC'>" & objName & "</font></b></a>" )
Response.Write (" " )
End If
rsSelect.Close
End Sub
Function GetCatID()
Current = Request("ID" )
If Current = "" Then
Current = 0
End If
GetCatID = Current
End Function
%>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="%90" id="AutoNumber1">
<tr>
<td width="100%"><% Call PrintParents(Request("ID" )) %></td>
</tr>
<%
For t=1 To Rs.RecordCount
If Rs.Eof Then exit for
%>
<tr>
<td width="100%"><a href="Kategori.asp?ID=<%=Rs("ID" ) %>"><font face="Arial" size="2" color="#000000"><%=Rs("Kategori" ) %></font></a></td>
</tr>
<%
Rs.Movenext
Next
Rs.Close
Set Rs = Nothing
%>
</table>
</center>
</div>