SqlConnection conn = new SqlConnection(connStr); conn.Open();SqlCommand cmd = new SqlCommand("select * from table", conn);SqlDataReader reader = cmd.ExecuteReader();while (reader.Read()){ //blabla}