Solved

Recordset in ADO

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Joomla Website Malfunction 9 95
Summernote and form validation 10 103
reset email that plugins send alerts to 1 36
remove background quote mark from widget 6 24
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
The viewer will learn how to count occurrences of each item in an array.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now