I'm trying to create a web application in ASP.NET C #, but I'm not sure how to do it. p>
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);
}
}
I tried to use only the command .Close()
but it did not work, I tried to use .Close()
and .Dispose()
but it did not work either.
When I did this, I realized that by passing the command .Open()
it opens the connection normally, but when it passes the .Close()
command and the .Dispose()
the connection is still open in firebird.
To find out the number of open connections in firebird I am using the command select * FROM MON$ATTACHMENTS