<%
'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
'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")
%>