Share via


CeCreateDatabaseWithProps (EDB) (Windows CE 5.0)

Send Feedback

This function creates a new database in a mounted volume.

This function does not work with CEDB databases. For more information about CEDB, see CEDB Reference.

CEOID CeCreateDatabaseWithProps(PCEGUIDpGuid,CEDBASEINFOEX*pInfo,DWORDcProps,CEPROPSPEC*prgProps);

Parameters

  • pGuid
    [in] The CEGUID of the mounted volume in which to create the database. You can mount a volume by calling the CeMountDBVolEx (EDB) function.
  • pInfo
    [in] A pointer to the CEDBASEINFOEX (EDB) structure that specifies the name, type, sort orders, and other characteristics of the database.
  • cProps
    [in] The number of elements in the prgProps array.
  • prgProps
    [in] An 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.

Return Values

The OID of the new database indicates success. NULL indicates failure. To get extended error information, call GetLastError. The following table lists possible values returned by GetLastError:

Return Value Description
ERROR_INVALID_PARAMETER Indicates that one or more parameters are not valid. See "Remarks" later in this topic for more information.
ERROR_DUP_NAME Indicates that a database already exists with the specified name.
ERROR_NOT_SUPPORTED Indicates that the specified CEDBASEINFOEX structure contains either CEDB_VALIDMODTIME or CEDB_SYSTEMDB. Neither of these values is supported by EDB.
ERROR_ALREADY_EXISTS Indicates that the prgProps parameter contains a property for which the specified propid or name already exists.
Also occurs if you try to add more than one AUTO_xxxproperty to a database.
ERROR_NOT_FOUND Indicates that the volume specified by pGuid does not exist.
ERROR_DISK_FULL Indicates that there is not enough disk space to create the database.
ERROR_BAD_LENGTH Indicates that the specified database name is greater than 128 characters.
ERROR_ACCESS_DENIED Indicates an attempt to create a database with two primary key sort orders.

Remarks

The ERROR_INVALID_PARAMETER may be returned in the following situations:

  • If pGuid is NULL.
  • If pInfo is NULL.
  • If pInfo->wVersion is not equal to CEDBASEINFO_VERSION.
  • If pInfo->dwFlags does not have the CEDB_VALIDNAME flag. EDB requires that a name be supplied when creating a database.
  • If pInfo->szDbaseName is empty or contains all spaces.
  • If pInfo->dwFlags has the CEDB_VALIDSORTSPEC flag, and
    pInfo->wNumSortOrder is greater than CE_MAXSORTORDER (16).
  • If there are sort orders specified, and any of the elements in pInfo->rgSortSpecs are not valid. The following members of a SORTORDERSPECEX (EDB) structure must be valid:
    • The wVersion member must be set to SORTORDERSPECEX_VERSION.
    • The wNumProps member cannot be greater than CE_MAXSORTPROP (16).
    • The property IDs in the rgPropID member must all have valid CEDB data types from the CEVT_xxx enumeration.
    • The property cannot be a CEVT_STREAM data type (you cannot create sort orders on streams).
  • If cProps is not 0 and prgProps is NULL.
  • If the CeAddDatabaseProps (EDB) function, which is called by this function, returns any errors.

If sort orders are specified in pInfo, this function automatically creates those sort orders. Any properties included in those sort orders are automatically added to the property set supported by the database. You can add other properties that you want to store in the database by using CeAddDatabaseProps (EDB). Because sort orders increase the system resources needed to perform each insert and delete operation, you should keep the number of sort orders to a minimum. You can use the CeSetDatabaseInfo (EDB) function to change the sort order.

The following list highlights the differences between this function and the CEDB equivalent function:

  • The OID returned by this function is not recognized by the Microsoft® Windows® CE operating system (OS) as an object-store OID. You can only use this OID in other EDB API functions.
  • Because a property must exist in an EDB database before it can be written to (or must be created during the first write), this function allows the user to define the properties when creating a database. The properties can be changed at a later time by using the CeAddDatabaseProps and CeRemoveDatabaseProps functions.
  • In EDB, if you do not specify a sort order for the database, no sort order is created by default.
  • There is no system volume in EDB.

Requirements

OS Versions: Windows CE 5.0 and later.
Header: Windbase.h.
Link Library: Coredll.lib.

See Also

CeMountDBVolEx (EDB) | CeAddDatabaseProps (EDB) | CeRemoveDatabaseProps (EDB) | CeSetDatabaseInfo (EDB) | CEDBASEINFOEX (EDB) | CEPROPSPEC (EDB)

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.