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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Tab Text with Record Count

Status
Not open for further replies.

dfrazell

IS-IT--Management
May 26, 2005
65
US
I'm trying to display the record count next to tabs on my web page that switch the view when clicked. For example I have | Tab A (x) | Tab B (y) | Tab C (z) | on my web page where x, y, and z represent the number of records that were written to the page. My problem is I don't have the record count when I render this part of the page. In classic VB ASP how can I revise the tab text to reflect the number of records?
 
Can't you get the record counts from the database before you render the page? E.g., if you are using a SQL database, use SELECT COUNT(table_id) AS record_count_a FROM table WHERE etc. You should not be counting records as you loop through the record set.
 
I can. I was trying to avoid hitting the DB twice.
 
I doubt hitting the DB again for a record count is going to be much of a performance hit. Besides, that eliminate counting the records as you loop through them.

I think certain kinds of cursors can return the record count, but they are usually expensive cursors.

Finally, and I think this is the best solution, you could load the record set into VBScript arrays, close the record set, get the uBound of the arrays for your record count, and then loop through the arrays to display the data. Until now I've loaded data into arrays by looping through the record set and using redim preserve on the arrays, but here's a much better way if you are using SQL Server (I haven't tried it yet):

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top