URGENT(COUNTING OF RECORD IN DATAABSE USING ASP)

D

Daniel Ng

Hi all, may i know how to write a simple code using asp to count the
number of record in the Access and display the figure out... Thanks...
 
R

Ray Costanzo [MVP]

<%
Dim oADO, oRS, sSQL
sSQL = "SELECT COUNT(UniqueID) FROM tableName"
Set oADO = CreateObject("ADODB.Connection")
oADO.Open "your connection string, www.connectionstrings.com"
Set oRS = oADO.Execute(sSQL)
Response.Write "Record count is " & oRS.Fields.Item(0).Value
oRS.Close : Set oRS = Nothing
oADO.Close : Set oADO = Nothing
%>

Some will say to do a COUNT(*). I personally count a column that I know
will never have any nulls, such as whatever is the primary key in the table.

Ray at work
 
T

Tom Kaminski [MVP]

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top