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

how to use this (RecordCount)? 1

Status
Not open for further replies.

FlatHead

Programmer
Oct 13, 2000
50
GB
I don't know how to use this as well as i don't know if this is the right one for my job? All i want is to count how many records i display already on a page found on a database through query?

All i have is:
strSQL = "SELECT p.id as pide,.................."

oRecord.PageSize = 30
oRecord.Open strSQL, oConnect, 3

if ((oRecord.eof) and (oRecord.bof)) then .................
oRecord.MoveFirst
if orecord.eof then exit for
if ISNULL(oRecord("ID")) then
Response.Write &quot;<td align=middle>&quot; &amp; spc &amp; &quot;<p>&amp;nbsp;</td>&quot;
else
Response.Write &quot;<td align=middle><align=center> &quot; &amp; Record (&quot;ID&quot;) &amp; &quot; &amp;nbsp;</td>&quot;
end if

I included that as example of how im calling the query and how as well im printing on the browser my record results.
I don't know HOW and WHERE should i use the RECORDCOUNT thing to count my results number?????

please help
ZAC
 
I don't mean to sound odd but I don't see how your if statement fits into the page it checks to see if you are at the end of the file and at the beginning of the file so Basically it might work if you only have one record.

As far as the record count I have never seen it or heard of it. If I were you I would just try putting it in different places and see what happens.

Whenever I want to count how many records I get. I usually use a while loop &quot;While not RecSet.EOF&quot; and have a variable declared that adds one to itself every time through the loop. I also make sure I set the variable to 0 at right before the loop.

Hope this helps

Walt III
SAElukewl@netscape.net
 
1) if the RS is BOF and EOF, then there are no records
2) RecordCount only works with some cursors such as Static, any other cursor , recordcount will return -1
Karl
kb244@kb244.com
Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top