Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CRecordset GetRecordCount

CRecordset GetRecordCount

Scheduled Pinned Locked Moved C / C++ / MFC
databasec++beta-testinghelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dave Carkeet
    wrote on last edited by
    #1

    Ive found myself on more than one ocassion writing code in MFC which imlements a database query using a CRecordset, and churns through the records one at a time doing something to each record. This type of operation is typically time consuming, and therefore I would like to present the user with a percentage complete indicator (Progress Bar). My problem of course is that I dont know the size of the record set a priori (GetRecordCount returns only the highest numbered record so far accessed). Of course I dont want to churn thru the record set before hand to determine its size. Any ideas on an elegant way to attack this? Other ways to produce satisfactory progress feedback to the user? Thanks very much in advance! :) Dave Carkeet, Santiago, Chile

    T 1 Reply Last reply
    0
    • D Dave Carkeet

      Ive found myself on more than one ocassion writing code in MFC which imlements a database query using a CRecordset, and churns through the records one at a time doing something to each record. This type of operation is typically time consuming, and therefore I would like to present the user with a percentage complete indicator (Progress Bar). My problem of course is that I dont know the size of the record set a priori (GetRecordCount returns only the highest numbered record so far accessed). Of course I dont want to churn thru the record set before hand to determine its size. Any ideas on an elegant way to attack this? Other ways to produce satisfactory progress feedback to the user? Thanks very much in advance! :) Dave Carkeet, Santiago, Chile

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      Ok, so MoveLast before GetRecordCount is not an option. Seems that percentage is absolutely necessary you need to perform query with 'SELECT COUNT(*)' and identical WHERE clause before traversing the recordset. Of course, number of records could change between two queries in multi-user scenario, so value returned from first query should be treated with care. COUNT(*) can also be pretty expensive, depending on WHERE. I don't know your exact requirements, but maybe it's enough to just display a message like 'Please wait, processed 19002 records so far...'. Tomasz Sowinski -- http://www.shooltz.com.pl

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups