MySqlBackup.Net icon indicating copy to clipboard operation
MySqlBackup.Net copied to clipboard

Views aren't be exported

Open aarhor opened this issue 2 years ago • 2 comments
trafficstars

I want to use this Library in my Project (.NET 7). It works fine, but there aren't any views in the sql file. For the Backup I use the following code:

public static bool Create_DB_Backup(string Destination)
    {
       try
        {
            using (MySqlConnection conn = new MySqlConnection(Connectionstring()))
            {
               using (MySqlCommand cmd = new MySqlCommand())
                {
                    using (MySqlBackup mb = new MySqlBackup(cmd))
                    {
                        cmd.Connection = conn;
                        conn.Open();
                        mb.ExportInfo.ExportViews = true;
                        mb.ExportToFile(Destination);
                        conn.Close();
                    }
                }
            }
            return true;
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message.ToString());
            return false;
        }
    }

aarhor avatar Apr 04 '23 20:04 aarhor

Your code appears to be correct. I'm not able to recreate the error that you've mentioned. Perhaps, you error is related to something else.

adriancs2 avatar May 25 '23 04:05 adriancs2

Hello, Thanks for the answer. I'll have a look into it. Maybe something has changed in my project since my original post...

aarhor avatar May 25 '23 17:05 aarhor