Tour World

Tour World

  • NA
  • 1
  • 1.1k

SQL Query only returns one item (rather than complete list)

Oct 20 2014 6:49 AM
I have an SQL query within ASP.NET, but it only seems to return 1 result rather than filling the list with 4 as it should (as the query itself is correct)
Code:
List<string> dropItems, dropItems2;

using (var dbContext = new DatabaseContext())
{
dropItems = dbContext.Database.SqlQuery<String>(
String.Format("SELECT locations.Code FROM locations")).ToList();
}
using (var dbContext = new DatabaseContext())
{
dropItems2 = dbContext.Database.SqlQuery<String>(
String.Format("SELECT locations.Name FROM locations")).ToList();
}


After the code executes, each list only contains one item rather than 4 which they both should

F.Y.I - The item I'm always receiving rather than the full 4 is just the last one

Answers (1)