Share via


JetDetachDatabase2 函式

適用于: Windows |Windows Server

JetDetachDatabase2 函式

JetDetachDatabase2函式會釋放先前附加至資料庫會話的資料庫檔案。

Windows XP:JetDetachDatabase2 是在 Windows XP 中引進的。

    JET_ERR JET_API JetDetachDatabase2(
      __in          JET_SESID sesid,
      __in          const tchar* szFilename,
      __in          JET_GRBIT grbit
    );

參數

sesid

要用於 API 呼叫的資料庫會話內容。

szFilename

要卸離的資料庫名稱。 如果 szFilenameNull 或空字串,則附加至 sesid 的所有資料庫都會中斷連結。

grbit

指定下列零個或多個選項的位群組。

意義

JET_bitForceCloseAndDetach

強制關閉和卸離資料庫。 如果不支援JET_bitForceCloseAndDetach,則會傳回JET_errForceDetachNotAllowed。

JET_bitForceDetach

強制卸離資料庫。 如果不支援JET_bitForceDetach,則會傳回JET_errForceDetachNotAllowed。

傳回值

此函式會傳回具有下列其中一個傳回碼 的JET_ERR 資料類型。 如需可能 ESE 錯誤的詳細資訊,請參閱 可延伸的儲存引擎錯誤錯誤處理參數

傳回碼

Description

JET_errSuccess

作業已成功完成。

JET_errBackupInProgress

正在備份資料庫,而且無法中斷連結。

JET_errDatabaseInUse

JetOpenDatabase已開啟資料庫。 在中斷連結之前,必須先關閉資料庫。

JET_errDatabaseNotFound

資料庫先前未附加 (請參閱JetAttachDatabase 或 JetAttachDatabase2)

JET_errForceDetachNotAllowed

不支援JET_bitForceDetach。

JET_errInTransaction

嘗試在交易中中斷連結資料庫。

備註

如果使用 JetAttachDatabase) 開啟附加資料庫 (,則必須在卸離之前先使用 JetCloseDatabase 關閉。

僅限 Windows 2000:呼叫 JetTerm 之前尚未中斷連結的資料庫,會在下次呼叫 JetInit 時自動重新附加。

規格需求

需求

用戶端

需要 Windows Vista 或 Windows XP。

Server

需要 Windows Server 2008 或 Windows Server 2003。

標頭

在 Esent.h 中宣告。

程式庫

使用 ESENT.lib。

Dll

需要ESENT.dll。

Unicode

實作為 JetDetachDatabase2W (Unicode) 和 JetDetachDatabase2A (ANSI) 。

另請參閱

JET_ERR
JET_GRBIT
JET_SESID
JET_TABLEID
JetAttachDatabase
JetAttachDatabase2
JetCloseDatabase
JetCreateDatabase
JetCreateDatabase2
JetInit
JetOpenDatabase
JetTerm