Wrox Programmer Forums
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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 30th, 2011, 10:51 AM
Authorized User
 
Join Date: Feb 2011
Posts: 37
Thanks: 8
Thanked 0 Times in 0 Posts
Default LINQ to Entities Select Query

Hi Imar

I understand were your coming from using the Enumerable 'Single()' Method but when I try to implement it within my code I get syntax errors

Code:
Using myLiteratureCatalogue As New Model1.Literature_Cataloguing_SystemEntities
            Dim getReservationStatus = (From publication In myLiteratureCatalogue.Publications Where publication.PublicationID = (PublicationID)
                                       Select publication.ReservationID).Single(), publication.StatusID).Single()

            ReservationID = getReservationStatus.ReservationID
            StatusID = getReservationStatus.StatusID


End Using
It doesn't look as thought this is possible within my build?
 
Old April 30th, 2011, 11:15 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I am not psychic nor can I use your code as-is in one of my own sites to reproduce the problem, so posting the actual error message you get might help ;-)

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old April 30th, 2011, 01:36 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Oh, BTW, check out my first example of Single. Notice how I am wrapping the entire query (starting with From all the way to the end) in parenthe4ses and then call Single() on the *query*, not the individual fieldws.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
update multiple columns in an update statement debbiecoates SQL Server 2000 1 August 17th, 2008 04:01 AM
UPDATE statement takwirira ASP.NET 2.0 Basics 7 March 7th, 2007 07:48 PM
insert and/or update statement carswelljr SQL Language 3 September 28th, 2006 10:03 AM
Update Statement some error thas123 ADO.NET 1 January 8th, 2006 10:30 AM





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