Compartilhar via


Creating a Database (Windows CE 5.0)

Send Feedback

Use the CeCreateDatabaseEx function to create a database in any volume. CeCreateDatabaseEx identifies the volume, names the database, identifies the sort order, and accepts a user-defined type identifier. The sort order is an index that is applied to a database to manipulate the record ordering. It is defined when the database is created, but can be altered at a later time. The type identifier, while it is user-defined, is commonly used to identify similar types of databases.

To create a database within the object store in Windows CE 2.10 and later

  1. Call the CREATE_SYSTEMGUID macro to create a global identifier for the object store.

    The returned GUID can act as an identifier for referring to the object store.

  2. Call the CeCreateDatabaseEx function, using the CEGUID that was created in the previous call to the CREATE_SYSTEMGUID macro.

When you create a database on a mounted volume, it is usually a good idea to make the database uncompressed. Accessing a mounted volume is usually slower than accessing the object store: compressing and decompressing slows the process even further. Therefore, create your database as an uncompressed database, unless you expect the database to be larger than the storage card can contain.

Changing the compression setting for an existing database does not affect existing records. Only new and modified records are stored at the new compression setting.

To set compression on a database after the database is created

  1. Create a CEDBASEINFO structure with the CEDB_VALIDBFLAGS value set in the dwFlags value.

  2. Turn off the CEDB_NOCOMPRESS bit in the dwFlags value as shown in the following code fragment:

    dwFlags &= ~(CEDB_NOCOMPRESS);
    
  3. Call the CeSetDatabaseInfoEx function with the previous CEDBASEINFO structure.

See Also

Databases

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.