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

Recordcount problem with an oracle database

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello everybody!

I've got a problem.
I'm developping an ASP application.
I need to do a recordcount like this:

Dim arsTempo
Set arsTempo=Server.CreateObject("ADODB.Recordset")

SQLQuery = "SELECT A.ID, A.designation FROM RAPPORT R
INNER JOIN ACTIVITE A ON A.ID= R.refActivite GROUP BY
A.ID, A.Designation ORDER BY A.Designation, A.ID"
arsTempo_Open SQLQuery, acnCurrent, 3

if not arsTempo.EOF then
nbActivite = arsTempo.RecordCount
Response.Write("nb activité :" & nbActivite)
end if

it returned : "nb activité :-1"

I tried with doing arsTempo.movelast before the recordcount

Is there someone who knows what to do?

Thanks [afro]
 
By default, you are not allowed to use rs.RecordCount. You have to set certain properties:
Code:
 rs.CursorLocation = adUseClient
 rs.CursorType = adOpenDynamic

Palooka
 
Even then, the documentation says that RecordCount may not return the correct value unless you've already moved to the end of the recordset. You need to do an rs.MoveLast before the rs.RecordCount.

I find the most reliable way to count records is to do it manually, in a loop...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top