Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function is used to add properties to an existing database.

Syntax

BOOL CeAddDatabaseProps(
  PCEGUID 
pGuid,
  CEOID 
oidDb,
  DWORD 
cProps,
  CEPROPSPEC* 
prgProps
);

Parameters

pGuid

[in] CEGUID of the mounted volume in which the database identified by the oidDb parameter resides. You can mount a volume by using the CeMountDBVolEx (EDB)function.

oidDb

[in] Object identifier (OID) of the database in which to add property IDs. This database must exist in the volume specified by the pGuidparameter. This OID must have been generated by the CeCreateDatabaseWithProps (EDB)function.

cProps

[in] Number of elements in the prgPropsarray.

prgProps

[in] Array of CEPROPSPEC (EDB)structures. This array specifies the set of properties to create in the new database. In EDB, you must define properties before you can write them by using the CeWriteRecordProps (EDB)function.

Return Value

TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. The following table shows possible values:

Return Value Description

ERROR_ACCESS_DENIED

You attempted to create a database with two primary key sort orders.

ERROR_ALREADY_EXISTS

An element of prgPropscontains a property for which the ID or name already exists. A name is automatically generated if not specified.

ERROR_INVALID_PARAMETER

One of the following conditions exists:

  • The pGuidparameter is set to NULL.

  • The oidDbparameter is set to NULL.

  • The cPropsparameter is set to zero.

  • The prgPropsparameter is set to NULL.

  • Any of the elements in prgPropsare not valid. The following members of the CEPROPSPECstructure must be valid:

    • wVersionmust be set to CEPROPSPEC _VERSION .

    • propidmust be a valid CEVT_ xxx data type.

    • The dwFlagsmember for a property can include DB_PROP_COMPRESSED only if the property is a CEVT_STREAM.

ERROR_NOT_ENOUGH_MEMORY

There is not enough memory available to create the volume.

ERROR_NOT_FOUND

The volume specified by pGuiddoes not exist, or the database specified by oidDb does not exist in the specified volume.

ERROR_NOT_SUPPORTED

An attempt was made to add more than the maximum supported number of properties. EDB supports up to 1024 properties.

ERROR_SHARING_VIOLATION

Another thread currently has the database open.

Remarks

This function succeeds only if the database is not open.

You must define the properties of a database before you can write data, using CeWriteRecordProps, unless the database is currently empty.

Properties can also be defined by calling CeCreateDatabaseWithProps. If you create any sort orders when calling CeCreateDatabaseWithProps, EDB internally creates all of the sort properties.

If one of the property IDs specified in the prgPropsarray already exists in the database, this function succeeds, and GetLastErrorreturns ERROR_ALREADY_EXISTS. All other property IDs that do not exist are still added.

To remove properties from a database and potentially reduce the size of a volume, use the CeRemoveDatabaseProps (EDB)function.

Requirements

Header windbase.h
Library coredll.lib
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also