im trying to back up my database with the code below using mysqlBackUp 2.0.4
private void button9_Click_1(object sender, EventArgs e)
        {
            try
            {
                string constring = "Data Source=localhost;User Id=root;Password=sulyman;database=accounting_db";
                MySqlConnection conn = new MySqlConnection(constring);
                string file = "D:\\backup.sql";
                cmd = new MySqlCommand();
                cmd.Connection = conn;
                dal.Open();
                MySqlBackup ba = new MySqlBackup(cmd);
                ba.ExportToFile(file);
                dal.close();
                MessageBox.Show("done");
            }
            catch(Exception ex)
            { MessageBox.Show(ex.Message); }
        }
but i got the error
a object reference note set to an instance of an object
at the line
 ba.ExportToFile(file);
where is the wrong with my code please
 
    