Menu

Table row count

Help
beekay
2017-01-17
2017-01-17
  • beekay

    beekay - 2017-01-17

    I get a non-zero value from table.getRowCount() eventhough it has no data and at times zero for a table with data. What could be the reason?

     
  • Gord Thompson

    Gord Thompson - 2017-01-17

    This sounds like the issue where Access fails to properly update the row count in the table metadata when performing certain operations (e.g., manually inserting or deleting rows in Access datasheet view). If Jackcess reads that metadata value for operations like Table#getRowCount() then it can report an incorrect number of rows.

    The counts can be fixed in the table metadata by doing a Compact and Repair Database operation in Access. The actual number of rows could also be determined by doing a table scan, but that could obviously be slower than just reading a single metadata value. Doing a scan of an IndexCursor based on the primary key of the table might be a somewhat faster alternative to a full table scan.

     

Log in to post a comment.