problem with recordcount

problem with recordcount

Post by fil » Thu, 31 Aug 2000 04:00:00



Hi,

I need to know how many records there are in a ado-recordset: i did this:
<%
Set objDC = Server.CreateObject("ADODB.Connection")
ObjDC.open = "provider=msdasql; driver={microsoft access driver (*.mdb)};
dbq=c:\inetpub\wwwroot\res.mdb"

sql="select name from studres where ... ;"
set rs=objDC.execute(sql)

rec=rs.recordcount
response.write(rec)
%>

but i always get -1 !

Any reason for this and how to get the real amount?
Thanks
fil

 
 
 

problem with recordcount

Post by Carl Prothma » Thu, 31 Aug 2000 04:00:00



Quote:> I need to know how many records there are in a ado-recordset: i did this:
> <%
> Set objDC = Server.CreateObject("ADODB.Connection")
> ObjDC.open = "provider=msdasql; driver={microsoft access driver (*.mdb)};
> dbq=c:\inetpub\wwwroot\res.mdb"

> sql="select name from studres where ... ;"
> set rs=objDC.execute(sql)

> rec=rs.recordcount
> response.write(rec)
> %>

> but i always get -1 !

See the following ADO FAQ
http://www.able-consulting.com/ADO_Faq.htm#Q2

--

Thanks,
Carl Prothman
Microsoft Visual Basic MVP
http://www.able-consulting.com

 
 
 

problem with recordcount

Post by Haim Kat » Fri, 01 Sep 2000 04:00:00


I believe you need a
rs.movelast
rec = rs.recordcount

alternatively you can try the following query
select count(*) from table
That should return the number of rows.

Haim Katz


> Hi,

> I need to know how many records there are in a ado-recordset: i did this:
> <%
> Set objDC = Server.CreateObject("ADODB.Connection")
> ObjDC.open = "provider=msdasql; driver={microsoft access driver (*.mdb)};
> dbq=c:\inetpub\wwwroot\res.mdb"

> sql="select name from studres where ... ;"
> set rs=objDC.execute(sql)

> rec=rs.recordcount
> response.write(rec)
> %>

> but i always get -1 !

> Any reason for this and how to get the real amount?
> Thanks
> fil

 
 
 

1. Problem in RecordCount with Delphi4 and Paradox

I work with Delphi 4.01 and Paradox 7 on Novell 3.12 network.

I have a big table with more than 200000 records.
When I use a SetRange, the Table.RecordCount method returns 0 instead of the
real count of the range. When I add a record, the record is good, but the
RecordCount is still 0.
After a restructuration, the table works fine while some days before
crashing.

If you have any idea, please answer me, thanks !!!!

FRED.

2. Fastest way to do median calculations

3. Anyone having problems with .recordcount?

4. Reading Excel Cells..........I don't know how

5. Problem with RecordCount

6. sym link to raw log

7. Problem with RecordCount in DAO3.0.

8. Oracle web listener has internal error after

9. Problem with RecordCount and TDbGrid, TTable and Oracle 7.3

10. A2K - ADO - Problem with RecordCount property

11. Strange problem with recordcount here ??

12. A2K - ADO - Problem with RecordCount property

13. DAO Recordcount vs. ADO Recordcount