dotConnect for MySQL Documentation
Devart.Data.MySql Namespace / MySqlDump Class / Connection Property
Example

In This Topic
    Connection Property (MySqlDump)
    In This Topic
    Gets or sets the MySqlConnection used by this instance of the MySqlDump.
    Syntax
    'Declaration
     
    Public Shadows Property Connection As MySqlConnection
    public new MySqlConnection Connection {get; set;}

    Property Value

    The connection to a data source. The default value is a null reference.
    Remarks
    When generating scripts, all operations are executed within database that Database property of associated MySqlConnection object references to. When restoring tables using the generated script, the property Database is used only if IncludeDatabase has been set to false.
    Example
    This sample shows how to use MySqlDump object to create a backup of two tables.
    public void DumpIt(MySqlConnection myConnection)
    {
      myConnection.Open();
      MySqlDump mySqlDump = new MySqlDump();
      mySqlDump.Connection = myConnection;
      myConnection.Database = "Test";
      mySqlDump.IncludeDrop = true;
      mySqlDump.Tables = "Dept;Emp";
      mySqlDump.Backup();
      StreamWriter stream = new StreamWriter("d:\\tmp\\mysqldump.dmp");
      stream.WriteLine(mySqlDump.DumpText);
      stream.Close();
      Console.WriteLine("Dumped.");
    }
    Public Sub DumpIt(ByVal myConnection As MySqlConnection)
      myConnection.Open()
      Dim mySqlDump As MySqlDump = New MySqlDump
      mySqlDump.Connection = myConnection
      myConnection.Database = "Test"
      mySqlDump.IncludeDrop = True
      mySqlDump.Tables = "Dept;Emp"
      mySqlDump.Backup()
      Dim stream As StreamWriter = New StreamWriter("d:\tmp\mysqldump.dmp")
      stream.WriteLine(mySqlDump.DumpText)
      stream.Close()
      Console.WriteLine("Dumped.")
    End Sub
    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