...

View Full Version : Number of posts in my db?



Speedy
07-07-2004, 11:10 PM
Hi,

I wonder if someone could trll me how to count the amount of posts in my db?
I got the following code for my db connection:



<%
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("db/db.mdb")
Set Recset = Connect.execute("SELECT * FROM register ORDER BY namn")
%>


PS! I've searched around the forum but didn't find anything that helped me DS!

/Speedy

raf
07-07-2004, 11:43 PM
select count(*) as numberofposts from register

Returns a recordset wit 1 record and one variable : numberofosts

Speedy
07-07-2004, 11:48 PM
Eh? You just made my questionmark even bigger, how do you mean?

Sorry for being such a n00b :confused:

raf
07-08-2004, 12:03 AM
sql has a serie of so called agregation function. COUNT() is such a funtion. COUNT(*) will count the number of records, and the ' as numberofposts' will just give another name to the variable that contains the count-value.

you can hen acces it like any other recordset. Only difference is that this one only contains one variable-value pair



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum