try { string strBackupFileName = GetBackUpFileName(); StreamWriter strBackupFile = new StreamWriter(strBackupFileName); ProcessStartInfo psInfo = new ProcessStartInfo(); psInfo.FileName = @"c:\Users\current.user\source\xampp\mysql\bin\mysqldump.exe"; psInfo.RedirectStandardInput = false; psInfo.RedirectStandardOutput = false; psInfo.Arguments = "- u root -h localhost --databases --hex-blob -n -t dashboard --tables dashboard.backup --where='updated_at < NOW() - INTERVAL 365 DAY'"; psInfo.UseShellExecute = false; psInfo.RedirectStandardOutput = true; Process backup_process = Process.Start(psInfo); string stdout; stdout = backup_process.StandardOutput.ReadToEnd(); strBackupFile.WriteLine(stdout); backup_process.WaitForExit(); strBackupFile.Close(); backup_process.Close(); MessageBox.Show("Backup done at file:" + strBackupFileName); } catch (Exception ex) { MessageBox.Show("Error during the backup: \n\n" + ex.Message); }
psInfo.Arguments = "- u root -h localhost --databases --hex-blob -n -t dashboard --tables dashboard.backup --where='updated_at < NOW() - INTERVAL 365 DAY'";
-
u
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)