Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > BOOK: Professional LINQ
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 10th, 2009, 07: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);
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 09: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



All times are GMT -4. The time now is 02:52 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.