Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Recordset in ADO

Posted on 1998-09-15
3
Medium Priority
?
246 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 200 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

971 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