Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 14th, 2003, 12:46 AM
Authorized User
 
Join Date: Nov 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to eapsokha
Default RecordCount property doesn't work

Could you help please? RecordCount property returns only value -1, how to make it working?

__________________
Mr. Sokha Eap
Webmaster
UNDP Cambodia
 
Old November 14th, 2003, 03:06 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000
Default

it may provider which doesnot support this property
You can determine whether your recordset supports the RecordCount property by
    using the Recordset object’s Supports method with the dApproxPosition or AdBookmark parameters, as demonstrated in the following code:

blnApproxPos = rsExample.Supports(adApproxPosition)
blnBookmark = rsExample.Supports(adBookmark)

If the value of blnApproxPos or blnBookmark is True, then RecordCount immediately reflects the actual number of records in the recordset.

the Recordset object cursortype must also supports movement (forward and backward) like set to adOpenStatic


Ahmed Ali
Software Developer
 
Old November 15th, 2003, 03:13 AM
Registered User
 
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

make your recordet to point to 1st record and then again try to recordcount..
Rahil

Looking Forward For Your Prompt Reply
 
Old November 16th, 2003, 09:15 PM
Authorized User
 
Join Date: Nov 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to eapsokha
Default

Where they should be placed if compared to the recordset execution line?
blnApproxPos = rsExample.Supports(adApproxPosition)
blnBookmark = rsExample.Supports(adBookmark)

What should I do if both variables return value FALSE?

Quote:
quote:Originally posted by alyeng2000
 it may provider which doesnot support this property
You can determine whether your recordset supports the RecordCount property by
    using the Recordset object’s Supports method with the dApproxPosition or AdBookmark parameters, as demonstrated in the following code:

blnApproxPos = rsExample.Supports(adApproxPosition)
blnBookmark = rsExample.Supports(adBookmark)

If the value of blnApproxPos or blnBookmark is True, then RecordCount immediately reflects the actual number of records in the recordset.

the Recordset object cursortype must also supports movement (forward and backward) like set to adOpenStatic


Ahmed Ali
Software Developer
 
Old November 17th, 2003, 12:24 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 336
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alyeng2000
Default

supports method for recordset object is a test if recordset or other ado objects support certain property so before use this proberty test if it's supported.

Q?
what database you are connecting to?
if possible show us some of the code has the problem?

....

Ahmed Ali
Software Developer
 
Old February 10th, 2005, 01:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This may help to resolve your problem. I experienced it several years ago when I first went to ADO.

By default, the Microsoft ODBC Driver or OLE DB Provider creates a server-side recordset with a CursorType of forward-only (adOpenForwardOnly). A forward-only cursor does not support the RecordCount property, even if you move to the last record in the recordset after you've opened it.

If you need the RecordCount to be correct, then set the CursorType to something other than forward-only (e.g. adOpenKeyset or adOpenStatic). Using a dynamic cursor (adOpenDynamic) will not help in this case since the number of records in a dynamic cursor may change.

If you create a client-side recordset (adUseClient), then ADO automatically sets the CursorType to a static cursor (adOpenStatic), and hence the RecordCount property will always be correct for "client-side" recordsets.

For more info, see Microsoft KB Article Q194973



Larry Asher
 
Old February 10th, 2005, 01:28 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

Forward only cursortype would always return the record count as "-1" only.

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help RecordCount jpaul Pro VB Databases 1 January 29th, 2008 01:46 PM
Recordset.recordcount = -1 Huss Classic ASP Databases 0 February 17th, 2007 04:41 AM
RecordCount dpkbahuguna Beginning VB 6 9 March 23rd, 2006 01:16 AM
changing property doesn't work Vanni VB.NET 4 July 1st, 2005 07:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.