LINQ to SQL questions

LINQ to SQL questions

Postby 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.
joet919
 
Posts: 5
Joined: Mon 10 Sep 2007 18:17

Postby 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);
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16


Return to LinqConnect (LINQ to SQL support)