<% Dim linkRec Dim catsRec Dim sysRec Dim newcutoff Dim pagesize Dim SortOrder Dim defsort Dim homeurl Dim SortSQL Set linkRec = Server.CreateObject("ADODB.Recordset") Set catsRec = Server.CreateObject("ADODB.Recordset") Set sysRec = Server.CreateObject("ADODB.Recordset") Set objConn = Server.CreateObject ("ADODB.Connection") objConn.Open strConnect Set sysRec = objConn.Execute ("SELECT * FROM system ;") SortOrder = sysRec("defsort") homeurl = sysRec("homeurl") newcutoff = sysRec("newcutoff") pagesize = sysRec("linksperpage") defsort = sysRec("defsort") Set sysRec = Nothing SELECT Case defsort Case 0 SortSQL = "" Case 1 SortSQL = "ORDER BY title ASC" Case 2 SortSQL = "ORDER BY title DESC" Case 3 SortSQL = "ORDER BY datein DESC" Case 4 SortSQL = "ORDER BY datein ASC" End SELECT %> <% Set catsRec = objConn.Execute ("SELECT * FROM cats ORDER BY name ASC;") While NOT catsRec.EOF Set linkRec = ObjConn.Execute ("SELECT * FROM links WHERE catid = " & catsRec("catid") & " AND active = True " & SortSQL & ";") %>
    <%= catsRec("name")%>
<% If linkRec.BOF then Response.Write "
No links in this category
" end if While NOT linkRec.EOF %><% linkRec.MoveNext Wend catsRec.MoveNext Wend objConn.Close Set linkRec = Nothing Set catsRec = Nothing %>