Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2010 > BOOK: Professional Visual Basic 2010 and .NET 4
BOOK: Professional Visual Basic 2010 and .NET 4
This is the forum to discuss the Wrox book Professional Visual Basic 2010 and .NET 4 by Bill Sheldon, Billy Hollis, Kent Sharkey, Gaston Hillar, Rob Windsor, Jonathan Marbutt; ISBN: 9780470502242
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Visual Basic 2010 and .NET 4 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 April 1st, 2011, 01:18 PM
Registered User
Join Date: Mar 2011
Posts: 17
Thanks: 4
Thanked 1 Time in 1 Post
Question Code to output the LINQ query that groups doesn't work on my system


A suggestion to to author of Chapter 10 of this book, specifically of the LINQ piece of the chapter, to be a little bit more descriptive of the grouping part of LINQ to SQL part. The sample code for this used two nested 'for each' loops which I hadn't noticed while I was typing in the code for it. The result of course was that it didn't work. This was a change in the approach shown in the previous examples. But I think that there is something about LINQ that implies that the result of the query is really a collection of collections and, because that wasn't explained at all, I had difficulty with the sample. I think that on initial exposure to LINQ queries one has to change his/her mindset from SQL to OOP. But that doesn't seem to hit you until you want to do a GROUP BY query in LINQ. I know that that is one of the characteristics of LINQ to SQL, but I think the idea really needs to be fleshed out when doing GROUP BY queries. Then the reader will truly begin to understand LINQ.

Because LINQ is new to me, I may be incorrect here; if so, an explanation would be useful. I know that the book deals with a whole lot more than LINQ, but I intend to read what it says about LINQ before I move on to a book that is dedicated to LINQ and VB .NET 2010. By the way, WROX doesn't have one.



Last edited by mangel; April 1st, 2011 at 06:16 PM.. Reason: I figured it out. I can't type what I read.
The Following User Says Thank You to mangel For This Useful Post:
ksharkey (April 1st, 2011)
Old April 1st, 2011, 11:05 PM
Wrox Author
Join Date: Jun 2007
Posts: 16
Thanks: 1
Thanked 1 Time in 1 Post


Thank you for the idea. I'll try to keep it in mind in the future.
TTFN - Kent
Old April 4th, 2011, 04:39 PM
Registered User
Join Date: Mar 2011
Posts: 17
Thanks: 4
Thanked 1 Time in 1 Post
Smile One more suggestion

I believe that to be most helpful to the reader of the LINQ section of Chapter 10 the author should put all the sample code into one project. The reason is that doing so will create a few issues that do not show up when each code example is put into a separate project.

My inclination as I was reading was to do it this way. The result was that I had to work through a few gotchas that were not explained in the book.

Thanks to Imar I got the answers I needed. The solution was to instantiate the data context separately for each example, execute the sample code, and then dispose of it using its dispose method. This would have been necessary if one project had been used in order to get it to work in all cases.

I also put each sample, especially the ones with database updates involved, into a separate try/catch block.



Similar Threads
Thread Thread Starter Forum Replies Last Post
LINQ Query modification jsymons BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 12 October 14th, 2009 04:46 PM
Linq: DataBinding: 'System.Char' does not contain a property with the name 'X'. cortttt BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 August 21st, 2009 03:42 AM
How to get access to value in LINQ query result StevenF ASP.NET 3.5 Basics 6 May 12th, 2009 05:46 AM
Linq and namespaces System and System.Xml roman BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 July 4th, 2008 01:15 PM
simple query for displaying groups... suraj SQL Language 1 September 2nd, 2005 06:47 AM

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