"DROP TABLE IF EXISTS" or "DROP DATABASE IF EXISTS" will be added before "CREATE TABLE" or "CREATE DATABASE" if IncludeDrop property is set to true.
If Devart.Data.MySql.MySqlDump.IncludeDatabase 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 Devart.Data.MySql.MySqlDump.Tables property will be lost.
public void DumpIt(MySqlConnection myConnection) { myConnection.Open(); MySqlDump mySqlDump = new MySqlDump(); mySqlDump.Connection = myConnection; myConnection.Database = "Test"; mySqlDump.IncludeDrop = true; mySqlDump.Tables = "Emp;Dept"; 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.IncludeDrop = 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
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