Last modified: March 09, 2015
Applies to: Windows | Windows Server
The JetDetachDatabase function releases a database file that was previously attached to a database session.
JET_ERR JET_API JetDetachDatabase( __in JET_SESID sesid, __in const tchar* szFilename );
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.
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.
An attempt was made to detach a database while in a transaction.
Requires Windows Vista, Windows XP, or Windows 2000 Professional.
Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
Declared in Esent.h.
Implemented as JetDetachDatabaseW (Unicode) and JetDetachDatabaseA (ANSI).