dotConnect for MySQL Documentation
Devart.Data.MySql Namespace / MySqlConnectionStringBuilder Class
Members Example

In This Topic
    MySqlConnectionStringBuilder Class
    In This Topic
    Generates automatically connection strings used to connect to MySQL.
    Syntax
    Remarks
    The MySqlConnectionStringBuilder allows you to construct a connection string by assigning values to corresponding properties. After you have initialized all connection properties you need, use System.Data.Common.DbConnectionStringBuilder.ConnectionString property or ToString method to obtain the connection string built.
    Example
    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
    Inheritance Hierarchy

    System.Object
       System.Data.Common.DbConnectionStringBuilder
          Devart.Common.DbConnectionStringBuilder
             Devart.Data.MySql.MySqlConnectionStringBuilder

    Requirements

    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

    See Also