Solved

Recordset in ADO

Posted on 1998-09-15
3
229 Views
Last Modified: 2013-12-25
When I try to get the number of records in my recordset
using the RecordsAffected property I always get -1 !?!

I wrote : Set x = con.Execute("select * from y", z, cmdText)

What should I do ?
0
Comment
Question by:netf_ds
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Accepted Solution

by:
rogerb082098 earned 50 total points
ID: 1855016
The method you have used for opening the Recordset does not support Recordcount. This caught me out once and I now use this more flexible method.

set YourConn=server.createobject("ADODB.Connection")
YourConn.open "YourODBC"
set YourRs=server.createobject("ADODB.Recordset")
sql="Your Select Statement"
YourRs.open sql_email,YourConn,3,3
nrec=YourRs.recordcount
response.write nrec&"<br>"

Roger
0
 

Author Comment

by:netf_ds
ID: 1855017
Thank you rogerb, but do you know why this method doesn't support Recordcount ?
0
 

Expert Comment

by:rogerb082098
ID: 1855018
Not off the top of my head I am affraid but I think its something to do with the way that database cursor is opened. It can be opened in a variety of ways that give varying degrees of access to the database. Static, Forward Only, Dynamic are the three common ones. But you will have to do some background on that yourself if you need more.

Roger
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question