Microsoft KB Archive/300163

= INFO: CeWriteRecordProps May Modify Database Position =

Article ID: 300163

Article Last Modified on 7/27/2004

-

APPLIES TO


 * Microsoft Windows CE 2.12 for the Handheld PC
 * Microsoft Windows CE 2.11 for the Handheld PC
 * Microsoft Windows CE 2.0 for the Handheld PC
 * Microsoft Windows CE 1.0
 * Microsoft Windows CE 3.0 for the Handheld PC

-



This article was previously published under Q300163



SUMMARY
The CeSeekDatabase or CeReadRecordProps API functions can be used to enumerate all records in a database. These functions maintain a pointer to the current record in the database. That pointer is preserved by calls to CeWriteRecordProps. However, calls to CeWriteRecordProps can modify the position of the current record. As a result, modification of records during performance of a database enumeration can cause an application to skip or reiterate records.



MORE INFORMATION
The CeSeekDatabase API function can be used to enumerate all records in a database through the use of the CEDB_SEEK_CURRENT flag with an increment of &quot;1&quot;. Similarly, if you open a database and you use the CEDB_AUTOINCREMENT flag, CeReadRecordProps can be caused to enumerate records. Both functions depend on the current position pointer for the open database handle. While writes to the database do not move the current position pointer off the current record, they may cause the record to be reinserted into a different position in the sort order. The reinsertion may occur even if the sort property for that record was not modified. If the record is inserted earlier in the sort order, the enumeration process will return to records that had already been enumerated. If the record is inserted later in the sort order, the enumeration process will skip over records. Therefore, your code can throw off enumeration if it performs writes to records in the same database that it is enumerating. Instead, applications can restart enumeration after performing a write or can perform a full scan before making any changes, accumulating a list of records to modify.

Additional query words: CeReadRecordPropsEx

Keywords: kbinfo KB300163

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.