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

In This Topic
    IncludeDatabase Property
    In This Topic

    Determines whether to include information about database into the dump text.

    This property is obsolete. Use ObjectTypes property instead.

    Syntax
    'Declaration
     
    Public Property IncludeDatabase As Boolean
    public bool IncludeDatabase {get; set;}

    Property Value

    true, if database information should be added into dump text; otherwise, false. The default value is false.
    Remarks

    When this property is set to true, CREATE DATABASE statement is generated for database that contains the tables.

    If IncludeDrop is set to true, the database is also deleted (DROP DATABASE IF EXISTS) before executing the script, so use this option with caution, because the tables you do not specify in Tables property will be lost.

    When executing a script generated with this option, Database property of associated MySqlConnection object is ignored.

    Example
    This sample demonstrates dumping of two tables (Dept and Emp). The script is written to a file after the operation is complete. In addition to tables, parent database is created too.
    public void DumpIt(MySqlConnection myConnection)
    {
      myConnection.Open();
      MySqlDump mySqlDump = new MySqlDump();
      mySqlDump.Connection = myConnection;
      myConnection.Database = "Test";
      mySqlDump.IncludeDatabase = true;
      mySqlDump.Backup();
      StreamWriter stream = new StreamWriter("d:\\tmp\\mysqldump.dmp");
      stream.WriteLine(mySqlDump.DumpText);
      stream.Close();
      Console.WriteLine("Dumped.");
      myConnection.Close();
    }
    Public Sub DumpIt(ByVal myConnection As MySqlConnection)
      myConnection.Open()
      Dim mySqlDump As MySqlDump = New MySqlDump
      mySqlDump.Connection = myConnection
      mySqlDump.IncludeDatabase = True
      mySqlDump.Tables = "Emp;Dept"
      mySqlDump.Backup()
      Dim stream As StreamWriter = New StreamWriter("d:\tmp\mysqldump.dmp")
      stream.WriteLine(mySqlDump.DumpText)
      stream.Close()
      Console.WriteLine("Dumped.")
      myConnection.Close()
    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