3
I am doing a project in Asp.net c# web Forms framework 4.5 and I did a test connection to a Firebird database, but when closing the connection it is not closing, I used the following code to open and close:
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’ve tried just the remote .Close()
but it didn’t work, I tried to use the .Close()
and the .Dispose()
but it didn’t work either.
When I did it debugging I realized that by passing the command .Open()
it opens the connection normally, but when it passes the command .Close()
and by .Dispose()
the connection remains open in Firebird.
To find out the number of open connections in Firebird I am using the command select * FROM MON$ATTACHMENTS
Dude I tried what this article, it was exactly what I used in the project but it also didn’t work
– Lucas Sousa
@Jhonathan your answer has to be based on the context of the question, have content and not just links, we would like to see more elaborate answers!
– user28366