title: How to close a connection with a firebird database
body: <p>I'm developing a project using asp.net c# webforms framework 4.5, and I did a connection test on Firebird database, but when I close this connection it isn't closing, I used the following code to do it:</p>
  
  <pre><code>string conDDNS;
  FbConnection conexaoDDNS;
  
  protected void Abrir_Fechar_Click(object sender, EventArgs e)
  {
      try
      {
          this.conDDNS = "DRIVER=InterBase/Firebird(r) driver;User=SYSDBA;Password=masterkey;Database=localhost:C:/AdCom/ADCOM.FDB";
  
          this.conexaoDDNS = new FbConnection(conDDNS);
          this.conexaoDDNS.Open();
          ListItem item = new ListItem("Conexão aberta");
          ListBox1.Items.Add(item);
  
          this.conexaoDDNS.Dispose();
          this.conexaoDDNS.Close();
          ListItem item2 = new ListItem("Conexão fechada");
          ListBox1.Items.Add(item2);
  
      }
      catch (Exception erro)
      {
          ListItem item = new ListItem(erro.ToString());
          ListBox1.Items.Add(item);
      }
  
  }
  </code></pre>
  
  <p>I have already used the <code>.Close()</code> and <code>.Dispose()</code> command but it didn't work.</p>
  
  <p>When I did this debugging I realized that when it pass by <code>.Open()</code>command it opens the connection, that is alright. But when it pass by <code>.Close()</code> command the connection is still open on database.</p>
  
  <p>To know the number of connections opened on database I'm using the following command:</p>
  
  <pre class="lang-sql prettyprint-override"><code>select * FROM MON$ATTACHMENTS
  </code></pre>