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 December 26th, 2010, 12:10 PM
Authorized User
 
Join Date: Nov 2010
Posts: 63
Thanks: 3
Thanked 0 Times in 0 Posts
Default Record Number in Entity

Hello
How do I get the record number in an entity?
Thanks.
Alex
 
Old December 28th, 2010, 11:34 AM
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,

You may want to read this: http://www.catb.org/~esr/faqs/smart-questions.html to get some inspiration on asking smart questions that result in the answers you're after.

Based on your current question, I can come up with a least 17 different follow up questions to give me some context. That's a bit too much for me now.

However, feel free to elaborate on what it is you're asking, and I'll be happy to provide you with an answer.

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 December 29th, 2010, 04:03 AM
Authorized User
 
Join Date: Nov 2010
Posts: 63
Thanks: 3
Thanked 0 Times in 0 Posts
Default Record Number

Hi Imar
Thanks for the link.
I think the question is really clear. And the answer (I found myself after fiddling around with the Help and Googling) is
Dim count = (From r In myentity.tables).Count

The point is that I thought after (page 559)

Unsing myEntities as new PlanetWorxEntities
 
Old December 29th, 2010, 04:05 AM
Authorized User
 
Join Date: Nov 2010
Posts: 63
Thanks: 3
Thanked 0 Times in 0 Posts
Default Record Number

Hi Imar
Thanks for the link.
I think the question is really clear. And the answer (I found myself after fiddling around with the Help and Googling) is
Dim count = (From r In myentity.tables).Count

The point is that I thought after (page 559)

Unsing myEntities as new PlanetWorxEntities
Dim myReview as Review

I can get the number of records doing

dim x=myreview.count

But I was wrong.

Somehow in asp.net everything is much less intuitive than in VB6.

Regards
Alex
 
Old December 29th, 2010, 06:52 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
I think the question is really clear
I disagree. Now I understand you want the number of records, rather than the record's number (such as an ID). The question may be clear to you but that's hardly relevant. It has to be clear to your audience (me, and other visitors to this forum) or we won't be able to help. I had no idea what you we're asking the first time so I couldn't help you.

With regard to your code:

Code:
Dim myReview as Review
Dim x = myReview.Count()
This won't work, as myReview is not a collection, but a single type. As such it has no Count method.

Hope this helps,

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
Current Record Number Base VB How-To 1 December 7th, 2005 05:26 PM
Record number in Access Report Niaz Access 4 July 19th, 2005 01:48 PM
record number maximum Jorge SQL Server 2000 3 December 3rd, 2004 12:00 PM
show the record number yami56 Access 9 April 5th, 2004 08:35 PM





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