'Declaration Public Event ConnectionOpening As ConnectionOpeningEventHandler
public event ConnectionOpeningEventHandler ConnectionOpening
Event Data
The event handler receives an argument of type ConnectionOpeningEventArgs containing data related to this event. The following ConnectionOpeningEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Connection | Gets the connection that is about to be opened. |
Remarks
This event is mainly intended to define login attributes in the connection string of the opening connection, but the other properties can be changed as well.
To make the process of updating the connection string simple and safe you can use an object of the System.Data.Common.DbConnectionStringBuilder type or of a derived class which is appropriate to the type of connection, for example System.Data.SqlClient.SqlConnectionStringBuilder for the System.Data.SqlClient.SqlConnection.
See Also