Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to count some records.

Status
Not open for further replies.

Linkan

Programmer
Feb 7, 2001
44
SE
Hello I am working with a sql 2000 db and I dont know how to write get a record cound from the following.
Please advice.

strSQL = "SELECT * FROM vJournal WHERE cus_id=" &GetCusId() &" ORDER BY topic_date DESC"
Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open strSQL, objConn


/Linkan
 
I'm not sure i understand your question.

strSQL = "SELECT COUNT(*) FROM vJournal WHERE cus_id=" &GetCusId()

will produce the number of records, but i'm almost sure you have a different problem?
br
Gerard
 
This works also...

strSQL = "SELECT * FROM vJournal WHERE cus_id=" &GetCusId() &" ORDER BY topic_date DESC"
Set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open strSQL, objConn

Response.Write "There are " & objRs.RecordCount & " records in this record set."

TW
 
Thanks, but how do I do if I need to count two different records in the same page. Total records and records for sertain type?

Thanks,
/Linkan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top