title: Executing SQL query with delay in C#
body: <p>I'm developing a game. In this game player can click on a button and attack a boss, and he has to wait 5 minutes for the results of the attack.The attack will be executed only after 5 minutes.
  <br>
  So here is my try:
  here is my function which is called when the button is clicked:</p>
  
  <pre><code>public static void InsertNewWaitingAttack(string attacker_id, string boss_id, DateTime  start, DateTime done)
  {
      string sql = "INSERT INTO WaitingAttacks (AttackerID,BossID,AttackTime,DoneTime) VALUES (@A_ID,@B_ID,@Start,@Done); ";
      sql += "WAITFOR DELAY '000:05:00'; ";
      sql += "INSERT INTO BossAttacks (AttackerID,BossID,AttackTime,Damage) VALUES (@A_ID,@B_ID,@Start,@Damage); ";
      sql += "DELETE FROM WaitingAttacks WHERE AttackerID=@A_ID AND AttackTime=@Start;";
      SqlConnection sc = new SqlConnection(conString);
      using (SqlCommand cmd = new SqlCommand(sql, sc))
      {
          cmd.Parameters.AddWithValue("A_ID", attacker_id);
          cmd.Parameters.AddWithValue("B_ID", boss_id);
          cmd.Parameters.AddWithValue("Start", start);
          cmd.Parameters.AddWithValue("Done", done);
          cmd.Parameters.AddWithValue("Damage", 500);
          sc.Open();
          cmd.ExecuteNonQuery();
          sc.Close();
      }
  }
  </code></pre>
  
  <p>But when I'm calling this function I'm getting the following error:
  <br></p>
  
  <blockquote>
    <p>Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.</p>
  </blockquote>
  
  <p><strong>EDIT:</strong> To clarify my question, this is an asp.net application. The solution should consider that the server should serve multiple clients.
  <br>
  if the user enters the "Result page" before the execution of the attack, he will see countdown to the execution of the attack.(Which means that the start time of the attack should always be accessible.)<br>
  <strong>EDIT #2:</strong>
  <br>
  The question is still relevant. I didn't find any solution yet.</p>