backup d'une base de données
Bonjour,
J'ai créé une fonction qui fait un backup de ma base de données MySQL
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| public void backup(string fileName)
{
StreamWriter file = new StreamWriter(fileName);
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
psi.FileName = mysqldump;
psi.RedirectStandardInput = false;
psi.RedirectStandardOutput = true;
psi.Arguments = string.Format(@"-u{0} -p{1} -h{2} {3}",
user, pwd, server, database);
psi.UseShellExecute = false;
System.Diagnostics.Process process = System.Diagnostics.Process.Start(psi);
string output;
output = process.StandardOutput.ReadToEnd();
file.WriteLine(output);
process.WaitForExit();
file.Close();
process.Close();
} |
La procédure fonctionne bien. Mais au moment où j'appelle mysqldump une fenêtre MS DOS s'ouvre. Je pensais la rendre invisible en mettant
Code:
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
mais ça ne fonctionne pas.
Y t-il un moyen de rendre cette fenêtre invisible?
Merci