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
Maik Brauer
NA
12
43.2k
LINQ to Entities query and Distinct on GUID
Jul 4 2011 4:44 PM
Hi all,
when I use the LINQ to Entities and then a Distinct to get unique Guids, I'm getting all GUIDs.
DB-Entry 1: {b3f86f18-f661-4511-a8b5-f85aa8e41b29}
DB-Entry 2: {b3f86f18-f661-4511-a8b5-f85aa8e41b29}
DB-Entry 3: {7078d941-0906-4a1b-9a27-85cfc9cf382b}
DB-Entry 4: {7387d57e-6ac5-4b3b-b7f5-833383530bb6}
using (OrderTableEntities msgcontext = new OrderTableEntities())
{
try
{
var Query = from c in msgcontext.tbl_Order
select c.OrderGuid;
var distinctGuids = Query.Distinct();
} catch
{
}
}
After Execution of this code-part, all 4 rows are queried. Basically I would have expected to get just
3 Entries back. What could cause this issue, that it is not possible to get the DISTINCT Guid?
Thanks.
Reply
Answers (
3
)
Help me please , How to write a loop of data into Database by Linq
How can i be from Zero to Hero in Linq?