OracleConnection.Open 方法

定义

使用 ConnectionString 指定的属性设置打开一个到数据库的连接。Opens a connection to a database with the property settings specified by the ConnectionString.

public:
 override void Open();
public override void Open ();
override this.Open : unit -> unit
Public Overrides Sub Open ()

异常

连接未打开。The connection is not open.

不能更改数据库。Cannot change the database.

注解

OracleConnection 从连接池中绘制打开的连接(如果有)。The OracleConnection draws an open connection from the connection pool if one is available. 否则,它将建立与数据库的新连接。Otherwise, it establishes a new connection to the database.

备注

如果 OracleConnection 超出范围,则它表示的连接不会自动关闭。If the OracleConnection goes out of scope, the connection it represents does not close automatically. 因此,必须通过调用 Close显式关闭连接。Therefore, you must explicitly close the connection by calling Close.

适用于