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

Recordcount under ASP on an Oracle Database

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hello everybody!

I've got a new 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]
 
I would execute the SQL Query directly connected to the database to be sure its syntax is corect and it returns rows (I'll assume '-1' means an error and a zero (0) means no data returned).

Also, this question might be better asked in the ASP Forum.



=================================
Thomas V. Flaherty Jr.
Birch Hill Technology Group, Inc.
 
Hi, There are quirks in ASP recodsets that cause a -1
to be returned for counts in some cases...
See

The way I do that is with 2 queries
1 to return the count, then a second one to get the actual
data..

[profile]
 
Hi guys, I'm not an ASP programmer, but I use OLEDB in my VB projects and the OLEDB recordset has has some tricks, you can't access the RecordCount property unless you move to the last record, but this cause an error if the Recorset is empty, so I use this:

if not ( RS.EOF and RS.BOF) then
'RecorSet is not empty, you can navigate through it
...
end if

and there's another thing, Oracle doesn't use INNER JOIN, you need to use be explicity in your joins:

SELECT
A.ID,
A.designation
FROM
RAPPORT R,
ACTIVITE A
GROUP BY
A.ID,
A.Designation
HAVING
A.ID = R.refActivite
ORDER BY
A.Designation,
A.ID

Unless the Oracle's OLEDB Provider support the syntax you are using, but I´m not sure about that.

I hope this will help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top