I have a small C# app that executes queries every 10 seconds. Should I open and close the connection every time I execute a query (method #2) or keep it open until I close the app (method #1)?
Method #1:
class A
{
A()
{
connection.open()
}
public void fct()
{
//do stuff
}
~A()
{
connection.close()
}
}
Method #2:
class A
{
A()
{
}
public void fct()
{
connection.open();
//do stuff
connection.close();
}
~A()
{
}
}