MySqlConnection Constructor (String)

MySQL Connector/Net

Initializes a new instance of the MySqlConnection class when given a string containing the connection string.

Namespace:  MySql.Data.MySqlClient
Assembly:  MySql.Data (in MySql.Data.dll) Version: 6.2.2.0

Syntax

C#
public MySqlConnection(
	string connectionString
)
Visual Basic (Declaration)
Public Sub New ( _
	connectionString As String _
)
Visual C++
public:
MySqlConnection(
	String^ connectionString
)

Parameters

connectionString
Type: System..::.String
The connection properties used to open the MySQL database.

Remarks

When a new instance of MySqlConnection is created, the read/write properties are set to the following initial values unless they are specifically set using their associated keywords in the ConnectionString property.

PropertiesInitial Value
ConnectionStringempty string ("")
ConnectionTimeout15
Databaseempty string ("")
DataSourceempty string ("")
ServerVersionempty string ("")

You can change the value for these properties only by using the ConnectionString property.

Examples

See Also