 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : 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
|
|
|
|
|

September 12th, 2010, 12:59 PM
|
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 27
Thanks: 8
Thanked 0 Times in 0 Posts
|
|
Chapter 14 Page 483
I am getting an error in the code behine of the first try it out in chapter 14.
I think its related to the chapter 13 but i am not able to figure it our or may it's only a mistake in chapter 14.
This is my cod behind file:
Code:
public partial class Reviews_All : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
using (PlanetWroxEntities myEntities = new PlanetWroxEntities())
{
var allReviews = from review in myEntities.Reviews
where review.Authorized == true
orderby review.CreateDateTime descending
select review;
GridView1.DataSource = allReviews;
GridView1.DataBind();
}
}
}
The error i get is this in red:
Code:
Line 14: {
Line 15: var allReviews = from review in myEntities.Reviews
Line 16: where review.Authorized == true
Line 17: orderby review.CreateDateTime descending
Line 18: select review;
Any kind of input is welcome to get me started:
Thanks in advance for your time.
Tariq
|
|

September 12th, 2010, 02:59 PM
|
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 24
Thanks: 10
Thanked 0 Times in 0 Posts
|
|
what is the error message you get? Because I came across the same yesterday (maybe)... 
|
|

September 12th, 2010, 07:04 PM
|
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 27
Thanks: 8
Thanked 0 Times in 0 Posts
|
|
Thanks for looking into it:
This is the error i get:
Code:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1593: Delegate 'System.Func<PlanetWroxModel.Review,int,bool>' does not take 1 arguments
Source Error:
Line 14: {
Line 15: var allReviews = from review in myEntities.Reviews
Line 16: where review.Authorized == true
Line 17: orderby review.CreateDateTime descending
Line 18: select review;
Source File: c:\BegASPNETCS\Site\Reviews\All.aspx.cs Line: 16
|
|

September 13th, 2010, 02:04 AM
|
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 24
Thanks: 10
Thanked 0 Times in 0 Posts
|
|
Hey Tariq,
I had a somewhat similar error, which showed up as an error in the same codeblock. In my case something got changed in my web.config (targetFramework). Only difference is that in my case the error was in the 'Using' statement.
I guess in your case too, that it isn't a syntax error, but what it is???
Greetz from Sneek
|
|

September 13th, 2010, 02:46 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Tariq,
That code looks fine to me.
Are you sure you created the Entity Framework model correctly? Do you get IntelliSense on the myEntities variable? Do you see any other errors in the Error List of Visual Studio?
Imar
|
|

September 13th, 2010, 07:14 AM
|
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 27
Thanks: 8
Thanked 0 Times in 0 Posts
|
|
thanks for the reply Imar i got it fixed by changing the spelling of:
Authorized
to
Athorized
without a 'u'.
not sure why is that?
Tariq
|
|

September 13th, 2010, 08:19 AM
|
|
Authorized User
|
|
Join Date: Jul 2010
Posts: 23
Thanks: 7
Thanked 2 Times in 1 Post
|
|
You probably wrote it wrong when you made the attribute in the Reviews table 
|
|
The Following 2 Users Say Thank You to andreas5 For This Useful Post:
|
Imar (September 13th, 2010),
tariq (September 14th, 2010)
|
|

September 13th, 2010, 08:35 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Or you misspelled the column name when you created the database.
You can fix the database and update or recreate the model, or you can just fix the name in the model and leave the database as it is.
Imar
|
|

September 14th, 2010, 07:10 AM
|
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 27
Thanks: 8
Thanked 0 Times in 0 Posts
|
|
Yes i spelled it Athorized that is why i was getting an error.
Thanks for that and hope to chat 2 u if another issure arises.
Tariq
|
|

September 14th, 2010, 08:47 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
But does that also mean you're not using IntelliSense to the max by letting it complete the property name for you (misspelled or not)?
Imar
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Chapter 14 Page 548 Try it Out |
andreas5 |
BOOK: Beginning ASP.NET 4 : in C# and VB |
7 |
August 22nd, 2010 07:48 AM |
| Chapter 14 (Page 483) CSS Declaration |
jsymons |
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 |
11 |
September 18th, 2009 07:14 AM |
| Errata: Page 483 |
drupalmeister |
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 |
0 |
June 22nd, 2009 01:32 AM |
| Chapter 14 page 491 |
Will |
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 |
4 |
April 25th, 2009 04:52 AM |
|
 |
|