I try to use this code as a console application so that I can back up mydatabase automatics
I am not sure what wrong with it

```
static void Main(string[] args)
{    
    try
    {
        DateTime backupTime = DateTime.Now;
        int year = backupTime.Year;
        int month = backupTime.Month;
        int day = backupTime.Day;
        int hour = backupTime.Hour;
        int minute = backupTime.Minute;
        int second = backupTime.Second;
        int ms = backupTime.Millisecond;

        String tmestr = backupTime.ToString();
        tmestr = "C:\\" + year + "-" + month + "-" + day + "-" + hour + "-" + minute + ".sql";
        StreamWriter file = new StreamWriter(tmestr);
        ProcessStartInfo proc = new ProcessStartInfo();
        string cmd = string.Format(@"-u{0} -p{1} -h{2} {3} > {4};", "root", "", "localhost", "dbfile", "backup.sql");
        proc.FileName = "mysqldump";
        proc.RedirectStandardInput = false;
        proc.RedirectStandardOutput = true;
        proc.Arguments = cmd;//"-u root -p smartdb > testdb.sql";
        proc.UseShellExecute = false;
        Process p = Process.Start(proc);
        string res;
        res = p.StandardOutput.ReadToEnd();
        file.WriteLine(res);
        p.WaitForExit();
        file.Close();

    }

    catch (IOException ex)
    {
        MessageBox.Show("Disk full or other IO error , unable to backup!");
    }
}

```