TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tour World
NA
1
1.2k
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
Reply
Answers (
1
)
i want to disply today date as a water mark
How select values from checkbox list in C# asp.net