using (SqlConnection SqlConnection = new SqlConnection("..."))
{
using (SqlCommand SqlCommand = SqlConnection.CreateCommand())
{
SqlCommand.CommandText = "...";
SqlConnection.Open();
using (SqlDataReader SqlDataReader = SqlCommand.ExecuteReader())
{
while (SqlDataReader.Read())
{
//...
}
}
}
}