MySqlConnector


MySqlConnection.CloneWith method

Returns an unopened copy of this connection with a new connection string. If the Password in connectionString is not set, the password from this connection will be used. This allows creating a new connection with the same security information while changing other options, such as database or pooling.

public MySqlConnection CloneWith(string connectionString)
parameterdescription
connectionStringThe new connection string to be used.

Return Value

A new MySqlConnection with different connection string options but the same password as this connection (unless overridden by connectionString).

See Also