Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : in C# and VB 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 September 9th, 2015, 04:13 PM
Authorized User
 
Join Date: Nov 2010
Posts: 63
Thanks: 3
Thanked 0 Times in 0 Posts
Default Getting query result LINQ

Hi
I'm trying to get the result of a view (called view_users) and then I want to go through the result (for each next) to send an email (for example).
Depending on the situation (if then), I want to get all users or only those with view_users.name is "Brown".
How do I declare this? I'm having troubles doing this.
Hope you can help.
Alex
 
Old September 9th, 2015, 04:21 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Isn't this what you already have in the code in the other thread (about the Count). Which part are you having troubles with?

Also, since this is not directly related to the book, please consider posting this in the General category here: http://p2p.wrox.com/asp-net-asp-12/

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 September 9th, 2015, 04:30 PM
Authorized User
 
Join Date: Nov 2010
Posts: 63
Thanks: 3
Thanked 0 Times in 0 Posts
Default

No, it's not the same and I think it's related to the book.
I probably did not explain well.
I have a view with users. I would like to get the data of all users or of those based on a condition (let's say by name "brown"). In the "count" example, I could declare the Users as integer.
But now I don't want to get the number of users, I want to get the columns of the users. How do I do this with LINQ?

Dim users as ???
Using myentities As New entity
If x=1 then
Dim users = (From r In myentities.users select r) 'Get data of all users
else
Dim users = (From r In myentities.users where r.name=N'Brown' select r) 'Get data of users named Brown
end if
for each user in r
next

What is wrong?
Thanks for your help.
 
Old September 10th, 2015, 03:21 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

>> No, it's not the same and I think it's related to the book.

Well, yes and no. It's related to the book since it deals with ASP.NET and LINQ. However, it's not directly related since your question doesn't deal with any of the text, exercises or code examples directly. If you post in the General category, you'll attract more visitors and are likely to get an answer faster.

Anyway, to discover the type, hover your mouse over Dim or users (I forgot where it shows up for VB). You'll likely see something like IQueryable Of user which will be the type that you need in your Dim statement.

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
LINQ Query returning only 1 record digink BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 5 May 24th, 2010 12:50 PM
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
How to get access to value in LINQ query result StevenF ASP.NET 3.5 Basics 6 May 12th, 2009 05:46 AM
Binding IEnumerable result set of a LINQ query prakashbpl .NET Framework 3.5 0 November 11th, 2008 04:41 AM
Using LINQ, with BeerHouse /Instant Result Project SoftMind BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 June 21st, 2007 03:08 AM





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