public void LoadLists() { using (var _connection = new SqlConnection(Global.WaifString)) { _connection.Open(); var sCmd = "SELECT TOP 10 Id, Name, Image, Popularity FROM {0} {1} ORDER BY Popularity DESC "; using (var cmd = new SqlCommand(String.Format(sCmd, "Waifu", " WHERE Confirmed = N'1'"), _connection)) { using (var rd = cmd.ExecuteReader()) { while (rd.Read()) { TopWaifu.Add(new WaifuLight(rd)); } } } using (var cmd = new SqlCommand(String.Format(sCmd, "Anime", ""), _connection)) { using (var rd = cmd.ExecuteReader()) { while (rd.Read()) { TopAnime.Add(new AnimeLight(rd)); } } } using (var cmd = new SqlCommand("SELECT TOP 6 Id, Name, Image, Popularity FROM Waifu WHERE Confirmed=N'1' ORDER BY Newid()", _connection)) { using (var rd = cmd.ExecuteReader()) { while (rd.Read()) { RandomWaifu.Add(new WaifuLight(rd)); } } } using (var cmd = new SqlCommand("SELECT TOP 10 Id, Title, Date FROM News ORDER BY Id DESC", _connection)) { using (var rd = cmd.ExecuteReader()) { while (rd.Read()) { var temp = new NewsFull(rd); temp.Date = temp.Date.Remove(temp.Date.LastIndexOf('.')); TopNews.Add(temp); } } } } }