Share via


Creating a Database

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

Use the CeCreateDatabaseEx (CEDB) 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 sort order. It is defined when the database is created, but can be altered later. The type identifier is user-defined and is commonly used to identify similar types of databases.

To create a database in the object store

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

    The returned GUID identifies the object store.

  2. Call CeCreateDatabaseEx, using the CEGUID that was created with CREATE_SYSTEMGUID.

When you create a database on a mounted volume, it is usually preferable 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 (CEDB) structure with the dwFlags member set to CEDB_VALIDBFLAGS.

  2. Turn off the CEDB_NOCOMPRESS extended flag in the dwFlags member as shown in the following example:

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

See Also

Concepts

CEDB Database Support