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,598
  • 83
  • 57
  • 92
mark333...333...333
  • 1,270
  • 1
  • 11
  • 26
  • 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.
  • 147,927
  • 63
  • 340
  • 553