failed to copy database as backup file
<p>Description:</p>

<ul>
<li><p>I am trying to copy my sql database as backup file, once I login, and redirect to <code>backup.aspx</code> and I clicked backup button, it prompt me an error output </p></li>
<li><p>If I open directly <code>backup.aspx</code> I can copy the database without any error</p></li>
<li><p>I knew that the problem is my database is connect after I login, so it tell me it is being used by another process</p></li>
<li><p>What I want to ask is that anyway can solved this problem ?</p></li>
<li><p>I aim to disconnect from db on page load but I cant make it, it still prompt me the same error</p></li>
</ul>

<p>Error message:</p>

<blockquote>
  <p>The process cannot access the file 'C:\Users\Roy\Desktop\backup
  fyp\10-18-2011\WebSite5\App_Data\Database.mdf' because it is being
  used by another process.</p>
</blockquote>

<p>Code for button click:</p>

<pre><code>    string time1 = DateTime.Now.ToString("dd-MM-yyyy hh-mmtt");
    Directory.CreateDirectory(@"C:/SME-Online/" + time1);
    string destination = @"C:/SME-Online/" + time1;
    string source = Server.MapPath(@"~/App_Data");
    File.Copy(Path.Combine(source, "Database.mdf"), Path.Combine(destination, "Database.mdf"), true);
    File.Copy(Path.Combine(source, "Database_log.LDF"), Path.Combine(destination, "Database_log.LDF"), true);
</code></pre>
