Updating Database Records

Database records are updated using the CeWriteRecordProps function. You need to provide the record's object identifier, and this is generally obtained by calling CeSeekDatabase. Listing 4.14 opens the company database using the CompanyID as the sort order. It then locates the first record with a CompanyID of 2, and then updates the telephone number for that record.

Listing 4.14. Locates and updates a record
 void Listing4_14() { HANDLE hDB; CEGUID ceObjStore; DWORD dwIndex; CEOID ceOidDB = 0; CREATE_SYSTEMGUID(&ceObjStore); hDB = CeOpenDatabaseEx(&ceObjStore, &ceOidDB, _T("Company"), propCompanyID, // prop.id. of sort order 0, // no auto-increment NULL); // no notifications if(hDB != INVALID_HANDLE_VALUE) { CEPROPVAL ...

Get Windows® CE 3.0 Application Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.