CeCreateSession (EDB)

Windows Mobile 6.5
A version of this page is also available for

This function creates a session to begin, commit, or roll back transactions.

HANDLE CeCreateSession(
  CEGUID* pGuid


[in] CEGUID of the mounted volume for which to create the session. Mount a volume by using the CeMountDBVolEx (EDB) function.

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

Return Value Description


The pGuid parameter is set to NULL.


The volume is not mounted, or pGuid is not a valid GUID.

Transactions group a set of changes into a single atomic commit operation so that either all changes occur, or none do. Transactions guard against partially modified databases in a system crash or power failure.

If you pass NULL for the session handle when opening a database, EDB internally creates a new session for that opened database, and each operation performed on the database is atomic. Obtain the session handle for an opened database by calling the CeGetDatabaseSession (EDB) function.

Even if you pass a session handle when you open a database, you have not started a transaction. You must first call the CeBeginTransaction (EDB) function for a session. Then all changes made to all databases opened with that session are logged until you call the CeEndTransaction (EDB) function. CeEndTransaction enables you to either commit or roll back all changes made in the session since the matching CeBeginTransaction call was made.

Once you have opened a database, you cannot change its session.

A single transaction cannot span multiple volumes. However, you can perform a transaction that spans multiple databases in one volume by passing the same session handle in the call to the CeOpenDatabaseInSession (EDB) function.

The handle returned from this function must be closed by calling the CloseHandle function. If a session is closed and it is still in a transaction, all of the uncommitted changes are rolled back.

Windows Embedded CEWindows CE 5.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions