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!

About rs.recordcount? 1

Status
Not open for further replies.

hu68

Technical User
Feb 19, 2002
30
0
0
CA
Hi,all

I uae the same database connection,same sql,if I use "set rs=conn.execute(sql)" to get recordset,rs.recordcount return value=-1.if I use "rs.Open sql, conn, adOpenStatic " ,rs.recordcount return correct value.Could some know the reason for it?
Thanks
 
The reason is that these statements use two different types of cursors.

rs=conn.execute(sql) uses adUseServer cursor, and you can't use record count with it.

rs.Open sql, conn, adOpenStatic uses adUseClient cursor, and you get the correct recordcount with it.

Hope this helps... <Dmitriy>
dbrom@crosswinds.net
 
Thank you dbrom
your reply is clear.
 
Same thing happens if you use a stored procedure, for instance, and an ADO Command object.

When you write:
rs = command.Execute(), it will also use a adUseServer cursor, similarly to conn.Execute() <Dmitriy>
dbrom@crosswinds.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top