Currently my code is constructed as follows.
using (var sqlCon = new SqlConnection(Context.ReturnDatabaseConnection()))
{
sqlCon.Open();
try
{
//Code here
}
catch (Exception e)
{
Console.WriteLine(e);
}
finally
{
sqlCon.Close();
}
}
Ideally from what I understand using the 'using' statement will take care of the connection being closed but I have my doubts due to what other people have said.
Thanks
NO need as object will automatically disposed when we use using
blocks. Go through this