Solved

Recordset in ADO

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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 …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to dynamically set the form action using jQuery.

760 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

20 Experts available now in Live!

Get 1:1 Help Now