|
|
Subject:
VB ADO Recordcount
Category: Computers > Programming Asked by: ny_insomniac-ga List Price: $5.00 |
Posted:
05 Feb 2004 11:25 PST
Expires: 06 Mar 2004 11:25 PST Question ID: 303824 |
|
There is no answer at this time. |
|
Subject:
Re: VB ADO Recordcount
From: hammer-ga on 05 Feb 2004 11:30 PST |
Unless something has changed, the RecordCount property does not work properly with the Oracle driver using VB/ADO. You do indeed have to do the separate COUNT query to get the record count. - Hammer |
Subject:
Re: VB ADO Recordcount
From: davesutherland-ga on 05 Feb 2004 21:03 PST |
I sometimes have the problem of recordsets returning a .RecordCount of -1. To resolve it you do a .MoveLast. Perhaps this will work for you too. -Dave |
Subject:
Re: VB ADO Recordcount
From: pileofgibs-ga on 11 Feb 2004 08:09 PST |
The RecordCount property returns the number of records ACCESSED as opposed to the number of records present in the recordset. To get the number of records you must use the following code: rs.MoveLast numrecs=rs.RecordCount The line rs.MoveLast moves to the last record in the recordset, accessing all of the records in the recordset, so that the RecordSet property will return the number of records in the recordset, rather than 0 (0 was returned because no records had been accessed). Hope this helps... |
Subject:
Re: VB ADO Recordcount
From: pileofgibs-ga on 11 Feb 2004 08:12 PST |
Sorry, typo in the above comment, it should read: The line rs.MoveLast moves to the last record in the recordset, accessing all of the records in the recordset, so that the RecordCount property will return the number of records in the recordset, rather than 0 (0 was returned because no records had been accessed). |
Subject:
Re: VB ADO Recordcount
From: hammer-ga on 11 Feb 2004 10:57 PST |
From my research, the Oracle driver does not support the kind of cursor needed to get an accurate recordcount. The symptom of this is that it always returns -1. The MoveLast solution is for a different kind of problem, which usually shows itself with a recordcount of 0. To get a recordcount, you can either loop through your entire recordset incrementing a counter, or you can do a separate COUNT query. This is a problem with what the driver itself does and does not support. I believe that this problem will only go away if they update the driver to support more types of cursors. - Hammer |
Subject:
Re: VB ADO Recordcount
From: hammer-ga on 11 Feb 2004 11:59 PST |
ny_insomniac, It's hard to get the whole story pieced together for the right versions of everything, but I'm seeing some indication that using a client-side cursor might get this feature for you. Have you tried this? You would call rs.CursorLocation = adUseClient before rs.Open. - Hammer |
Subject:
Re: VB ADO Recordcount
From: prince1010-ga on 20 Feb 2004 20:50 PST |
You have to use rs.reccount for count no. of records in recordset |
Subject:
Re: VB ADO Recordcount
From: ny_insomniac-ga on 02 Mar 2004 11:05 PST |
The cursorlocation worked. I am able to get my recordcount. Thank you. |
Subject:
Re: VB ADO Recordcount
From: hammer-ga on 02 Mar 2004 11:54 PST |
You're welcome. The indicators were too vague to post it as an official answer without having all the versions of everything you were running, but I'm glad I was able to point you in the right direction. - Hammer |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |