|
|
<%
'Declare variables
Dim oConnection, oRecordset, sSQL, iSpan, iNumlinks
Dim oRSCountLinks, oRSNewLinks
Dim iCategoryID, sCategoryName, sCategoryDescription
'store the desired SQL statement in a variable
sSQL="SELECT * FROM tblCategory WHERE ACTIVE='Y'"
'create an instance of the ADO connection and recordset objects
Set oConnection = Server.CreateObject ("ADODB.Connection")
Set oRecordset = Server.CreateObject ("ADODB.Recordset")
'open the connection to the database
oConnection.Open(sConnString)
'open the recordset object and execute the SQL
oRecordset.Open sSQL,oConnection
If oRecordset.Eof Then
Response.write " | There are no categories. | "
Else
'we will use the span variable to keep the number of category columns to 2
iSpan=0
'loop through the categories
Do while not oRecordset.eof
iSpan=iSpan + 1
If iSpan>2 then
Response.write ""
iSpan=1
End If
iCategoryID=oRecordset("CategoryID")
sCategoryName=oRecordset("CategoryName")
sCategoryDescription=oRecordset("CategoryDescription")
%>
<%= sCategoryName %> (
<%
'call the function CountActivelinks and pass in the Category ID
iNumlinks=CountActivelinks(iCategoryID)
Response.write iNumlinks %>
)
<%
'Call the Subroutine links and pass in the category id
NewLinks(iCategoryID)
Response.write " "
If BlnShowCategoryDescriptions=1 Then
Response.write sCategoryDescription
End If
'move on to the next record
oRecordset.MoveNext
%>
|
<%
Loop
%>
<% End If %>
|