From a1fe3a079bc5186b212cd484b527a9b01f2d0920 Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 13 Oct 2018 10:47:27 +0200 Subject: Using MysqlBackup.NET to dump the database --- kurier/Form1.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'kurier/Form1.cs') 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); + } + } + } } } -- cgit v1.2.3