Solved

Recordset in ADO

Posted on 1998-09-15
3
224 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
  • 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
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:
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

821 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