Counter records and show results

Tips submitted by ASPMaker users

Counter records and show results

Postby RichE » Fri Jan 06, 2012 9:04 pm

Hi Folks,

I found this useful snippet of ASP/SQL code (adapted to be used with ASP makers inbuilt functions).

[code]
<!--count the unbilled issues -->
<%
' Open connection to the database
If IsEmpty(Conn) Then Call ew_Connect()

DIM unbilledSQL, unbilledRS
unbilledSQL = "SELECT Count(*) AS unbilled FROM [ISSUED];"
Set unbilledRS = Server.CreateObject("ADODB.Recordset")
unbilledRS.Open unbilledSQL, Conn

' Display result
%>
<li><span class="footertitle">Unbilled Issues:</span>&nbsp; <%Response.Write unbilledRS("unbilled") %> </li>
<%

unbilledRS.Close
Set unbilledRS = Nothing
Conn.Close
Set Conn = Nothing
%>

it's part of my footer, and if you want to use it to count from multiple tables just change the unbilledSQL and unbilled to something relivent to the query, then just remove the Conn.Close and Set Conn = Nothing and put them in the final statement.

hope someone finds it useful, I've also found a useful collapsable DIV javascript which I'll post up later.

Regards

RichE

You could see it in action, but I'm not sure if I'm allowed to put my site details up (could mods or admin confirm if it's ok..?)
[/code]
RichE
 

Return to User Submitted Tips (ASPMaker)