Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
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
 
Old December 17th, 2013, 04:56 PM
Registered User
 
Join Date: Dec 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Problem with Try It Out in Chapter 17, Page 641

In step 2 of the Try It Out, it says to Open the ADO.NET Entity Data Model file PlanetWrox.edmx from the App_Code folder, right-click an empty space in the designer, and choose Update Model from Database. Wait until VWD has analyzed your database and click Finish.

When I did this step an Update Wizard window appears on the screen. I click on the Finish button in this window. After that, I received an error stating "Error 1109: Property 'PhotoAlbumId' is not mapped." Also, the following occurred:

* In the PhotoAlbum block, an extra navigation property called Pictures_1 appeared.
* In the Picture block, an extra field called PhotoAlbumID (I already had a field in that table called PhotoAlbumId) appeared as well as an extra navigation property called PhotoAlbum_1.

This is affecting my ability to complete this exercise. Any assistance will be greatly appreciated. Thank you.
 
Old December 17th, 2013, 05:05 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,

Can you check your database and make sure that:

1. Each table has a column called Id, which is set as the primary key and an identity.
2. You correctly created a relationship between PhotoAlbum.Id and Picture.PhotoAlbumId and between Genre.Id and Review.GenreId.

It sounds like something is wrong with your database schema but it's hard to tell what.

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 18th, 2013, 09:03 AM
Registered User
 
Join Date: Dec 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Confirmed on both counts.

I have an Id field in all tables.

I have a one-to-many relationship on the Genre and Review tables with Genre.Id being the "one" and Review.GenreId being the "many".

Also, I have a one-to-many relationship on the PhotoAlbum and Picture tables with PhotoAlbum.Id being the "one" and Picture.PhotoAlbumId being the "many".

When I perform Step 2 it adds an navigation property to the PhotoAlbum (called "Picture") and Picture (called "PhotoAlbum_1") tables, I get a duplicate association and I get "Error 11009: Property 'PhotoAlbumId' is not mapped".

When I undo the operation, the duplicate navigation properties and the duplicate association go away, but the error message stays on.
 
Old December 18th, 2013, 09:23 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can you send me a zipped version of the site (and database) by e-mail? Then I'll see if I can figure out what's wrong. You can find my e-mail address in the Introduction section of the book.

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 18th, 2013, 10:51 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Files received, thank you.

Did you maybe rename the PhotoAlbumId to PhotoAlbumID column in the Pictue table or vice versa? It looks the Picture class has two properties with almost the same name except for the capitalization.

What if you remove all entities from the diagram, save it, and then add them again?

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 18th, 2013, 11:06 AM
Registered User
 
Join Date: Dec 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I got the diagram to work again.

I removed all of the tables and did "Update Model from Database" and re-inserted the tables and associations that way.

Thank you for your assistance.

 
Old December 18th, 2013, 11:41 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Excellent; glad it's working.

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
Chapter 17 custom error page problem.. dany96 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 August 19th, 2011 10:17 AM
Chapter 17 Page 609: $safeitemname$ issue? AlexGrab BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 December 31st, 2010 06:06 AM
Chapter 19 - page 641 Struct RegisrtationInformation bon_chan BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 1 July 29th, 2010 03:49 PM
Chapter 17 Page 608 Try It out - Debugging your application ceboc BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 November 24th, 2009 12:46 PM
DataGrid Updates BLANK PAGE (Chapter 17) happyhorseygal BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 April 8th, 2004 01:11 PM





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