CeEndTransaction (EDB)

A version of this page is also available for

Windows Embedded CE 6.0 R3


This function ends a transaction.


BOOL CeEndTransaction(
  HANDLE hSession,
  BOOL fCommit


  • fCommit
    [in] Specifies whether to commit the transaction. Specify TRUE to have all pending changes committed to the database. Specify FALSE to roll back all pending changes. If you specify TRUE, the committed changes are not flushed to disk until the flush interval has elapsed or until you call the CeFlushDBVol (EDB) function.

Return Value

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

Return Value Description


The database is corrupted.


The hSession parameter is set to NULL or equal to INVALID_HANDLE_VALUE.


The session is not in a transaction.


This function fails if the session is not in a transaction. You must first call the CeBeginTransaction (EDB) function. When a transaction is running, all changes made to all databases using the same session are not committed or rolled back until this function is called. This function enables you to either commit and save all changes, or roll back and throw away all changes.

If changes are committed, they are not written to file until a flush occurs. The committed changes are cached until one of the following occurs:

  • The volume is explicitly flushed. For more information about explicitly flushing a volume, see CeFlushDBVol (EDB).

  • The FlushInterval parameter setting for the volume is reached.

  • The volume is unmounted.


    Even if a transaction is committed, some locks may still be held in the database. To ensure that all locks are released, close the handle to the database.


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


EDB Functions
CeCreateSession (EDB)
CeGetDatabaseSession (EDB)
CeBeginTransaction (EDB)
CeFlushDBVol (EDB)