how many results in recordset?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: how many results in recordset?

  1. #1
    Join Date
    Jun 2006
    Posts
    290

    how many results in recordset?

    Im trying to find a way to accomplish something and i need to know how many records are in a recordset once i pull it from a database. right now i know there are 3 , but i cant get it to tell me that.. i tried msgbox rsNews.recordcount but that shows -1 all the time. Any ideas on how i can get an accurate count of how many are there?

    Thanks

  2. #2
    Join Date
    Jun 2006
    Posts
    290
    quick note: im using adodb / mysql / odbc3.51 / vb6

  3. #3
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Use a static cursor and the RecordCount will work.

    You can also do a SELECT COUNT(*) WHERE and use the same WHERE criteria that you have in the SELECT statement that creates your recordset.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  4. #4
    Join Date
    Jun 2009
    Posts
    135
    Code:
    Rs.MoveLast
    MyVariable = Rs.RecordCount
    Rs.MoveFirst
    is another way...



    Good Luck

  5. #5
    Join Date
    Sep 2009
    Posts
    3

    RecordCount

    open the recordset like following

    RS= SqlQuery,connection,adopenstatic,adlockreadonly
    Dim count as integer
    count=RS.Recordcount
    .

Similar Threads

  1. recordset, based on query, returns wrong results
    By Natasha Korobova in forum VB Classic
    Replies: 4
    Last Post: 07-03-2003, 05:43 PM
  2. Replies: 0
    Last Post: 11-13-2001, 12:34 PM
  3. Creating a Recordset
    By Scott in forum ASP.NET
    Replies: 0
    Last Post: 11-12-2001, 10:14 PM
  4. Replies: 3
    Last Post: 10-04-2001, 12:32 PM
  5. Requerying a reshaped recordset
    By Jonathan Gibbs in forum VB Classic
    Replies: 0
    Last Post: 08-09-2001, 03:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center