Open 方法

開啟資料來源的連線。此方法需要指定提供者和資料庫位置的連線字串。

語法

Object.Open(ConnectionString)

引數:

  • Object必要。一律是 ADODB Connection 物件的名稱。

  • ConnectionString必要。指定提供者和資料庫位置

備註

下列範例說明 Open 方法的用法。

範例 1:

'Create ADODB.Connection Object
Dim ConnObj   ' Create a variable.
Set ConnObj = CreateObject("ADODB.Connection")
ConnObj.Open("ConnectionString") 'Creates DB Connection by Using Connection String
ConnObj.Close()
Set ConnObj = Nothing