In this sentence:
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
does it close connection in case of exception?
The safest way to do a "normal" query is
using (var conn = new SqlConnection("..."))
{
conn.Open();
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = "...";
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
// ...
}
}
}
}
Exceptions can be caught outside this code.