yokzu

yokzu

  • NA
  • 306
  • 0

Back up mysql db

Sep 12 2011 8:06 AM
Hello,
I want to back up mysql db. For this process, I am using the command below;
-------------
mysqldump -u root -pc111 dbtest  db_table_ci > deneme4.sql
-------------

But I want to execute this command from c#. I try the codes below but not working;
-------------
       string parametre1 = "mysqldump -u root -pc111 dbtest  db_table_ci > deneme4.sql";
            Process islem = new Process();
            islem.StartInfo.FileName = "C:\\Windows\\System32\\cmd.exe";
            islem.StartInfo.Arguments = parametre1;
            islem.StartInfo.RedirectStandardOutput = true;
            islem.StartInfo.UseShellExecute = false;
            islem.Start();
            islem.WaitForExit();
            string output = islem.StandardOutput.ReadToEnd();
            textBox6.Text = output;
-------------
How can I do that?
Regards.

Answers (3)