Advertisement

05.06.2008 at 04:41AM PDT, ID: 23379079
[x]
Attachment Details

The Order By not working in LINQ, also the query runs quite slow

Asked by cg_medistox in Language Integrated Query - LINQ, Microsoft Visual Basic.Net, Visual Studio 2008

Tags: VB.net, LINQ, http://www.every1preview.co.uk/

I am quite new to LINQ and quite nieve last week I thought it was an easy language aspect to get in to.

Anyway, i have a query that i wrote and for some reason the order by will not work on it, not only that, the query is returning all the rows from the database instead of the joined tables

I would expect because the tables are joined that only rows that refer to each other would return.

CapMans has approx 200 rows, CapDers has approx 70k rows and CarLeases has around 10 rows

All i want to return is the CapMans table but i need to know what rows are in the Leases table to see which Lease cars manufacturers show in the menu

The order by does not work, at all.

If you view the URL, the manufacturers menu down the side is the one i am trying to sort.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
The query is in the code snippet
 
Dim Query = From mans In DB.CapMans _
                    Join Cars In DB.CapDers _
                    On mans.cman_code Equals Cars.cder_mancode _
                    Join Leases In DB.CarLeases _
                    On Leases.CapID Equals Cars.cder_ID _
                    Order By mans.cman_code _
                    Select mans Distinct
 
 
[+][-]05.06.2008 at 10:14AM PDT, ID: 21509124

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Language Integrated Query - LINQ, Microsoft Visual Basic.Net, Visual Studio 2008
Tags: VB.net, LINQ, http://www.every1preview.co.uk/
Sign Up Now!
Solution Provided By: CarlVerret
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.06.2008 at 12:57PM PDT, ID: 21510479

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.06.2008 at 12:59PM PDT, ID: 21510499

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.07.2008 at 08:03AM PDT, ID: 21517172

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628