Wrox Programmer Forums
|
BOOK: Professional ASP.NET MVC 1.0 ISBN: 978-0-470-38461-9
This is the forum to discuss the Wrox book Professional ASP.NET MVC 1.0 by Rob Conery, Scott Hanselman, Phil Haack, Scott Guthrie; ISBN: 978-0-470-38461-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET MVC 1.0 ISBN: 978-0-470-38461-9 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 7th, 2009, 03:22 PM
Registered User
 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Did anyone else have this problem??

Hi everyone,

I had a problem creating the Details View from the code on page 48(pdf) with the following code (copied from that page). The error:

The type or namespace name, 'Objects' does not exist in the namespace 'System.Data'...

Code:

// // GET: /Dinners/Details/2
public ActionResult Details(int id) {
Dinner dinner = dinnerRepository.GetDinner(id);
if (dinner == null)
return View("NotFound");
else
return
View("Details", dinner);
}


and could not fix the problem until I changed the classname 'Dinner' to the keyword 'var' like so:
Code:
var dinner = dinnerRepository.GetDinner(id);


I've looked over my Dinner.cs code and don't see any errors. Can anyone explain what happened there?

Thanks,
Bill
 
Old April 9th, 2009, 01:00 PM
Friend of Wrox
Points: 546, Level: 8
Points: 546, Level: 8 Points: 546, Level: 8 Points: 546, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2009
Posts: 105
Thanks: 3
Thanked 20 Times in 19 Posts
Default

Do you have the using NerdDinner.Models? If I comment it out I see there would be a problem. But from your first code snippet Dinner is colored as a keyword.

To answer your question I do not have the problem you are having nor needed to use var.









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