Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Counting the number of records in a recordset

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-09-12 : 00:08:51
Jon writes "I have a fairly complex select statement in an asp page. Based on user choices, lets say it was (its sort of ugly):
SELECT email.emailID, email.tid, email.fromEmailAddress,
email.subject, email.content, email.emailDate, ticket.tid,
ticket.tboxid, ticket.ticketDate, ticket.CategoryID,
ticket.ticketState, tbox.tboxid, tbox.tboxname,
eGkbTicketCategories.ChildID, eGkbTicketCategories.ParentID,
eGkbCategories.CategoryName, eGkbCategories.CategoryId
FROM ticket, email, tbox, eGkbTicketCategories, eGkbCategories
WHERE ticket.ticketState=2 AND ticket.tid=email.tid AND
ticket.tboxID=tbox.tboxID AND eGkbTicketCategories.ChildID =
email.tid AND eGkbCategories.CategoryID =
eGkbTicketCategories.ParentID AND tbox.tboxid = 10053 AND
email.emailDate BETWEEN '05/09/00' AND '9/8/00'

Now what I need is a count of the number of records returned to be displayed before the records themselves are displayed. In other words, I need "your search returned x records" at the top
of the page, with the records themselves being displayed below.

Technical notes - evidently, I cannot move backwards in a recordset. I'm using MSSQL server v7, sp1. I'm also using IIS, not sure what version, but it was from option pack 4.0. I tried accessing the RecordCount property, but it returns a -1. Any thoughts?"
   

- Advertisement -