LINQ to SQL questions

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
joet919
Posts: 5
Joined: Mon 10 Sep 2007 18:17

LINQ to SQL questions

Post by joet919 » Mon 28 Sep 2009 15:40

I'm trying to use LINQ to ORacle to get the distinct column values from a table


var query = context.ExecuteQuery("select product_name from dsl_prequal_data where provider_name = 'C1'").Distinct();

foreach (DslPrequalDataN comp in query)
Console.WriteLine(" {0} ", comp.ProductName);


When I try and run this I get an invalidoperationexception because all the columns from the table definition dont exist in the output. How can I get around this? The table is large and has many columns and I want the disctinct value of just this one column name.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 29 Sep 2009 12:02

Why don't you use the following code:

Code: Select all

var query = context.ExecuteQuery("select distinct product_name from dsl_prequal_data where provider_name = 'C1'"); 

foreach (string comp in query) 
Console.WriteLine(" {0} ", comp);

Post Reply