コード例 #1
0
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            string file = txtCaminhoArquivo.Text;

            try
            {
                using (MySqlConnection conn = new MySqlConnection(constring))
                {
                    using (MySqlCommand cmd = new MySqlCommand())
                    {
                        mb = new MySqlBackup(cmd);

                        cmd.Connection = conn;

                        conn.Open();

                        mb.ImportProgressChanged += new MySqlBackup.importProgressChange(mb_ImportProgressChange);

                        mb.ImportFromFile(file);

                        conn.Close();

                        mb.Dispose();
                    }
                }
            }
            catch (Exception err)
            {
                MetroMessageBox.Show(this, err.Message);
            }
        }
コード例 #2
0
 public void Dispose()
 {
     _connectionString = null;
     if (_mySqlBackup != null)
     {
         _mySqlBackup.Dispose();
     }
     if (_mySqlCommand != null)
     {
         _mySqlCommand.Dispose();
     }
     if (_mySqlConnection != null)
     {
         _mySqlConnection.Dispose();
     }
 }