title: Backup SQL Server database by C# statement
body: <p>I want to create a backup for the database I worked on my application by C# statement.</p>
  
  <p>This is my code:</p>
  
  <pre><code>SqlConnection con = new SqlConnection(Connection.GetConnection());
  SqlCommand command = new SqlCommand();
  
  command.CommandText = "backup database [Pharmacy Database]to disk ="+"'"+path +"'";
  command.CommandType = CommandType.Text;
  command.Connection = con;
  
  con.Open();
  command.ExecuteNonQuery();
  con.Close(); 
  </code></pre>
  
  <p>And gives me an error:</p>
  
  <blockquote>
    <p>Cannot open backup device 'C:/Users/Abo Sala7/Desktop'.Operating system error 5 (failed to retrieve text for this error. Reason:15105).<br>
    BACKUP DATABASE is terminating abnormally.</p>
  </blockquote>