Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2010 > BOOK: Professional Visual Basic 2010 and .NET 4
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
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

Hi,

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.

Thanks,

Mike

Last edited by mangel; April 1st, 2011 at 06:16 PM. Reason: I figured it out. I can't type what I read.
Reply With Quote
The Following User Says Thank You to mangel For This Useful Post:
ksharkey (April 1st, 2011)
  #2 (permalink)  
Old April 1st, 2011, 11:05 PM
Wrox Author
Points: 61, Level: 1
Points: 61, Level: 1 Points: 61, Level: 1 Points: 61, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: Comox, BC, Canada.
Posts: 16
Thanks: 1
Thanked 1 Time in 1 Post
Default

Hello,

Thank you for the idea. I'll try to keep it in mind in the future.
__________________
TTFN - Kent
Reply With Quote
  #3 (permalink)  
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.

Thanks,

mangel
Reply With Quote
Reply


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



All times are GMT -4. The time now is 01:10 PM.


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