PDA

View Full Version : I try to use SELECT COUNT for count the number of department but it didn't work.


niluj
12-05-2005, 02:41 AM
I try to use SELECT COUNT for count the number of department but it didn't work.
my ASP code
Set Conndb = Server.createObject("ADODB.Connection")
Conndb.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("/db/person.mdb")
Dim rsTmp
Dim ArticleCount
Set rsTmp = Server.CreateObject("ADODB.Recordset")
rsTmp.Open "SELECT Count name AS numOfArticles FROM department ", conn
ArticleCount = rs("numOfArticles")
Response.Write ArticleCount
rsTmp.Close
Conndb.Close
Set Conndb = Nothing

can anyone help me what i'm doing wrong here?
thank you

vinyl-junkie
12-05-2005, 04:11 AM
This should work.

rsTmp.Open "SELECT Count(name) AS numOfArticles FROM department ", conn