MySqlConnectionStringBuilder Class
Generates automatically connection strings used to connect to MySQL.
This sample shows how to construct a connection string and pass it to
MySqlConnection object.
public void UseConnectionStringBuilder()
{
MySqlConnectionStringBuilder myCSB = new MySqlConnectionStringBuilder();
myCSB.Port = 3306;
myCSB.Host = "localhost";
myCSB.UserId = "root";
myCSB.Direct = true;
myCSB.Compress = true;
myCSB.Database = "demobase";
myCSB.MaxPoolSize = 50;
MySqlConnection myConnection = new MySqlConnection(myCSB.ConnectionString);
myConnection.Open();
Console.WriteLine(myConnection.ServerVersion);
myConnection.Close();
}
Public Sub UseConnectionStringBuilder()
Dim myCSB As MySqlConnectionStringBuilder = New MySqlConnectionStringBuilder
myCSB.Port = 3306
myCSB.Host = "localhost"
myCSB.UserId = "root"
myCSB.Direct = True
myCSB.Compress = True
myCSB.Database = "demobase"
myCSB.MaxPoolSize = 50
Dim myConnection As MySqlConnection = New MySqlConnection(myCSB.ConnectionString)
myConnection.Open()
Console.WriteLine(myConnection.ServerVersion)
myConnection.Close()
End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2