From my point of view:
try
{
using (SqlConnection connection = CreateSqlConnection(connString))
{
using (SqlCommand command = CreateSqlCommand()
{
}
}
}
catch
{
}
Above is the right way.
Because with this approach, if there is an exception with a connection to the database, it will come across inside the catch block. But with the first approach he will not.
source
share