diff options
author | emkael <emkael@tlen.pl> | 2018-10-13 10:47:27 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-10-13 10:47:27 +0200 |
commit | a1fe3a079bc5186b212cd484b527a9b01f2d0920 (patch) | |
tree | 11bfbe9e35cadc020ffd96e60724c0e40547201a /kurier/Form1.cs | |
parent | 51d31a9451c6ecdda114dd0c4a0a556bebedc19a (diff) |
Using MysqlBackup.NET to dump the database
Diffstat (limited to 'kurier/Form1.cs')
-rw-r--r-- | kurier/Form1.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/kurier/Form1.cs b/kurier/Form1.cs index a8bd7eb..86754e5 100644 --- a/kurier/Form1.cs +++ b/kurier/Form1.cs @@ -6,6 +6,7 @@ using System.Drawing; using System.Text; using System.Windows.Forms; using MySql.Data.MySqlClient; +using System.IO; namespace kurier { @@ -51,5 +52,25 @@ namespace kurier this.cbDatabaseName.SelectedIndex = 0; dbs.Close(); } + + private void bSave_Click(object sender, EventArgs e) + { + FolderBrowserDialog fd = new FolderBrowserDialog(); + if (fd.ShowDialog() == DialogResult.OK) + { + string filePath = Path.Combine(fd.SelectedPath, this.cbDatabaseName.SelectedItem.ToString() + DateTime.Now.ToString("-yyyyMMdd-HHmmss") + ".sql"); + try + { + MySQL c = new MySQL(this.cbDatabaseName.SelectedItem.ToString()); + c.backup(filePath); + c.close(); + MessageBox.Show("Wyeksportowano pomyślnie do pliku: " + filePath, "Sukces eksportu!", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Błąd eksportu!", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } } } |