<%
' List number of books for each vendor.
' =====================================
Dim strSQL_getBooksCountForEachVendor, objRS_getBooksCountForEachVendor
strSQL_getBooksCountForEachVendor = "SELECT BookVendor, COUNT(*) AS BookVendorCount FROM tblBooks GROUP BY BookVendor"
Set objRS_getBooksCountForEachVendor = objConn.Execute(strSQL_getBooksCountForEachVendor)
If (objRS_getBooksCountForEachVendor.EOF) Then
' No rows available to display.
Else
' Loop through all of the rows and display each row.
' (Using HTML Table as container for displaying SQL data results.)
%>
<%
Dim strBookVendor, iBookVendorCount
Do While (NOT objRS_getBooksCountForEachVendor.EOF)
strBookVendor = Trim( objRS_getAllNewsItems("BookVendor") )
iBookVendorCount = Trim( objRS_getAllNewsItems("BookVendorCount") )
'Now, display the current row.
%>
<%=strBookVendor%> |
<%=iBookVendorCount%> |
<%
'Move on to the next row.
objRS_getBooksCountForEachVendor.MoveNext()
Loop
%>
<%
End If
'Clean up
objRS_getBooksCountForEachVendor.Close
Set objRS_getBooksCountForEachVendor = Nothing
%>
|