错误消息:访问路径' C:\ backupSALES.sql'被拒绝。
这是我的代码:
private void BackupSALES()
{
string constring = "server=localhost;user=root;pwd=1234;database=sales;";
string file = "C:\\backupSALES.sql";
using (MySqlConnection conn = new MySqlConnection(constring))
{
using (MySqlCommand cmd = new MySqlCommand())
{
using (MySqlBackup mb = new MySqlBackup(cmd))
{
cmd.Connection = conn;
conn.Open();
mb.ExportToFile(file); //PROMTS AN ERROR
conn.Close();
}
}
}
}