Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > BOOK: Professional LINQ
|
BOOK: Professional LINQ
This is the forum to discuss the Wrox book Professional LINQ by Scott Klein; ISBN: 9780470041819
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional LINQ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2009, 06:19 PM
Registered User
 
Join Date: Jun 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Page 7 -- help with sample

The top of page 7 has a sample fragment. I wanted to make it run, so I looked at the download code. But that part was commented out. Can someone tell me what code is needed to execute the query? Instead of putting the output in a list box, how about just writing it to the console?
Code:
            DataContext context = new DataContext("Initial Catalog=AdventureWorks;Integrated Security=sspi");
            //Table<Contact> contact = context.GetTable<Contact>();
            //var query =
            //    from c in contact
            //    where c.FirstName.StartsWith("S")
            //    && c.LastName.StartsWith("A")
            //    orderby c.LastName
            //    select new { c.FirstName , c.LastName, c.EmailAddress };
            //IEnumerable<Contact> query =
            //    from c in contact
            //    where c.FirstName.StartsWith("S")
            //    && c.LastName.StartsWith("A")
            //    orderby c.LastName
            //    select new { c.FirstName, c.LastName, c.EmailAddress };
            //IEnumerable<Contact> query = contact.Where(a => a.FirstName.StartsWith("S") && a.LastName.StartsWith("A")).OrderBy(a => a.LastName);

            //foreach (var item in query)
            //    listBox1.Items.Add(item.FirstName + " " + item.LastName + " " + item.EmailAddress);





Similar Threads
Thread Thread Starter Forum Replies Last Post
want sample code mohiddin52 Access VBA 2 December 16th, 2006 04:54 AM
Need some more sample codes t.m.sundaram Visual Basic 2005 Basics 0 July 16th, 2006 08:16 AM
Need Sample code okshilato SQL Server 2005 0 March 28th, 2006 10:41 AM
one-to-many relationship sample matfis Classic ASP Databases 2 March 18th, 2005 11:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.