0

I'm creating a back up Window Forms C# application but my code doesn't work. :(

Here's my code:

Data dt = new Data();
dt.Connection();
try
{
    MySqlCommand cmd = new MySqlCommand("mysqldump -u root -p mypass mydb > backup.sql", dt.connect);
    cmd.ExecuteNonQuery();
}
catch{
}
Wai Ha Lee
  • 8,173
  • 68
  • 59
  • 86
mark333...333...333
  • 1,216
  • 1
  • 10
  • 25
  • You need to read the documentation carefully and then probably you can download the source files from the Link I have given you on the last question. To see how it works. – Mohit S Oct 02 '15 at 03:26

1 Answers1

0

MySQLDump is not a SQL command, it is a command-line utility.

You can use Process.Start to run it and capture the output.

Note that mysqldump.exe needs to be in your PATH environment variable, or you need to specify a complete path to it.

Community
  • 1
  • 1
Eric J.
  • 143,945
  • 62
  • 324
  • 540