I try to improve my progamming skill when it comes to database connections.
I found those 2 similar solutions on the internet, and I would like to know what the difference is, which one should I use and why?
using (OdbcConnection con = new OdbcConnection("connectionstring"))
{
con.Open
//QUERY
}
AND
private OdbcConnection con;
public Database()
{
con = new OdbcConnection("connectionstring");
}
public insertPerson()
{
con.Open();
//QUERY
}