- Loading...
- No images or files uploaded yet.
|
|
LINQ-August-2008LINQ - Language INtegrated Query for .NET 3.5 Fourth Meeting, Monday, August 18, 6:00 pm, at Compuware (new location) in Durham Welcome to LINQ!
Last month, we covered lambda expressions, and started into large topic of LINQ's object operators.
This month, we’ll explore complex LINQ queries, including multiple joins, joins with multiple conditions, equivalents for SQL keywords such as IN, EXISTS, and DISTINCT, custom comparers, set operations, and storing results in Dictionary and Lookup collections.
There's lots of sample code (which you can find here). Either bring the samples with you, or be prepared to take good notes!
This will be the last month for covering basic LINQ functionality. Over the next few months, we'll head into LINQ-to-SQL in depth.
This code has been submitted by Richard Wright
This is an example of a linq query without a 'where' statement, and that is why the District() and OrderBy() come after the 'select' statement.
public static List<string> getIndentities() { IQueryable<string> list = (from c in printers.Table_Network_Printers_Infos select c.Operator_ID).Distinct().OrderBy(d => d); result = list.ToList<string>(); return result; }
Here is the actual query:
SELECT [t1].[Operator_ID] FROM ( SELECT DISTINCT [t0].[Operator_ID] FROM [dbo].[table_Network_Printers_Info] AS [t0] ) AS [t1] ORDER BY [t1].[Operator_ID] -- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.30729.1 rpw |
Comments (0)
You don't have permission to comment on this page.