Last modified: March 09, 2015
Applies to: Windows | Windows Server
The JetDetachDatabase2 function releases a database file that was previously attached to a database session.
Windows XP: JetDetachDatabase2 is introduced in Windows XP.
JET_ERR JET_API JetDetachDatabase2( __in JET_SESID sesid, __in const tchar* szFilename, __in JET_GRBIT grbit );
The database session context to use for the API call.
The name of the database to detach. If szFilename is NULL or an empty string, all databases attached to sesid will be detached.
A group of bits specifying zero or more of the following options.
Forces the database to be closed and detached. If JET_bitForceCloseAndDetach is not supported, JET_errForceDetachNotAllowed will be returned.
Forces the database to be detached. If JET_bitForceDetach is not supported, JET_errForceDetachNotAllowed will be returned.
This function returns the JET_ERR datatype with one of the following return codes. For more information about the possible ESE errors, see Extensible Storage Engine Errors and Error Handling Parameters.
The operation completed successfully.
The database is being backed up, and cannot be detached.
The database has been opened by JetOpenDatabase. Databases must be closed prior to detaching.
JET_bitForceDetach is not supported.
An attempt was made to detach a database while in a transaction.
Requires Windows Vista or Windows XP.
Requires Windows Server 2008 or Windows Server 2003.
Declared in Esent.h.
Implemented as JetDetachDatabase2W (Unicode) and JetDetachDatabase2A (ANSI).