Dedel209
Messages postés29Date d'inscriptionsamedi 31 janvier 2009StatutMembreDernière intervention14 août 2014
-
2 mai 2013 à 19:48
thefolin -
3 mai 2013 à 20:20
Bonjour à tous.
Voici ma fonction pour le backup:
public void Backup()
{
try
{
DateTime Time = DateTime.Now;
int year = Time.Year;
int month = Time.Month;
int day = Time.Day;
int hour = Time.Hour;
int minute = Time.Minute;
int second = Time.Second;
int millisecond = Time.Millisecond;
//Save file to C:\ with the current date as a filename
string path;
path = "C:\\MySqlBackup" + year + "-" + month + "-" + day +
"-" + hour + "-" + minute + "-" + second + "-" + millisecond + ".sql";
StreamWriter file = new StreamWriter(path);
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "mysqldump";
psi.RedirectStandardInput = false;
psi.RedirectStandardOutput = true;
psi.Arguments = string.Format(@"-u{0} -p{1} -h{2} {3}",
uid, password, server, database);
psi.UseShellExecute = false;
Process process = Process.Start(psi);
string output;
output = process.StandardOutput.ReadToEnd();
file.WriteLine(output);
process.WaitForExit();
file.Close();
process.Close();
}
catch (IOException ex)
{
MessageBox.Show("Error , unable to backup!" + ex);
}
}
Le programme me renvoit à chaque fois le message du catch :
Error, unable to backup!System.IO.IOException : Le client ne dispose pas d'un privilège nécessaire.
Si je lance l'application avec les droits administrateurs ça ne change rien.