Nothing advanced here, I just wanted to store this code snippet somewhere for easy reuse…
SqlConnection conn = new SqlConnection(@"..."); SqlCommand cmd = new SqlCommand("select * from employee", conn); cmd.CommandType = CommandType.Text; using (conn) { conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { ... } }