Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 August 21st, 2010, 07:56 PM
Authorized User
 
Join Date: Jul 2010
Posts: 23
Thanks: 7
Thanked 2 Times in 1 Post
Default Chapter 14 Page 548 Try it Out

Hey, i am at the exercise at pages 543-549.

I request NewPhotoAlbum.aspx and go to ManagePhotoAlbum.aspx were i get this error:
Quote:
The member with identity 'Photoalbums' does not exist in the metadata collection.
Parameter name: identity
The first time i tried i got another error, wich i cannot remember much about, something about invalid data and EMD.32. So i copied the PlanetWrox.edmx and the PlanetWrox.mdf files from Source\Chapter14 into my project.

And now im stuck :(

Here is a picture of the error i get when i load ManagePhotoAlbum.aspx after filling out a name:
http://www.home.no/sd7/Error.jpg
 
Old August 22nd, 2010, 04:55 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Did yoo create the database as described in the book? That is, do all tables have an Id column that is a primary key *and* and identity? If you do that, you should be able to add them to the diagram and it should just work.

Just copying my dbml files into your project may not work if the database is not the same.

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 August 22nd, 2010, 06:48 AM
Authorized User
 
Join Date: Jul 2010
Posts: 23
Thanks: 7
Thanked 2 Times in 1 Post
Default

Quote:
Just copying my dbml files into your project may not work if the database is not the same.
I have copied the actual database (App_Data/PlanetWrox.mdf)
aswell as the ADO.NET Entity Model from App_Code.

They all got Id as their primary key, and all the Id columns have the property "Is Identity" set to "Yes, 1, 1", both in the database and the model ofc.

I have tried to copy only the database aswell and then generate the entity model, but with the exact same result.

Blerh, i might just load chapter 13 files and go through all the try it outs of 14 again, i must have done something wrong somewhere along the way.
 
Old August 22nd, 2010, 06:59 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I Googled for the error message you get and found this:

http://thedatafarm.com/blog/data-acc...ase-sensitive/

This led me to this:

Quote:
The member with identity 'Photoalbums' does not exist in the metadata collection.
Parameter name: identity
The set should be called PhotoAlbums with a capital A. Does changing the case of the EntitySetName in the EntityDataSource control in NewPhotoAlbum.aspx file fix the problem?

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 August 22nd, 2010, 07:12 AM
Authorized User
 
Join Date: Jul 2010
Posts: 23
Thanks: 7
Thanked 2 Times in 1 Post
Default

Not yet :P

Now i get the first error i was talking about. Really strange, because i didnt modify the DataSource manually after i got this error the first time.
Quote:
The argument types 'PlanetWroxModel.PhotoAlbum' and 'Edm.Int32' are incompatible for this operation. Near WHERE predicate, line 6, column 15.
 
Old August 22nd, 2010, 07:20 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can you show the code for the EntityDataSource control in the offending page?

I assume you get this error in ManagePhotoAlbum.aspx? If not, can you be more specific about the steps you're following and the exact locations of the error?

And how does the address for the page (in the browser's address bar) look when you go from NewPhotoAlbum.aspx to ManagePhotoAlbum.aspx?

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 August 22nd, 2010, 07:42 AM
Authorized User
 
Join Date: Jul 2010
Posts: 23
Thanks: 7
Thanked 2 Times in 1 Post
Default

Dang! Found it out! :P

I had forgot the ".Id" in Where="it.PhotoAlbum.Id = @photoAlbumId" in the ManagePhotoAlbums.aspx markup.

Thank you for exceptional support!
 
Old August 22nd, 2010, 07:48 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

That indeed explains the error. it.PhotoAlbum is of type PhotoAlbum while @photoAlbumId contains an Integer. The two are indeed not comparible.

Glad to hear it's working now.

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 14:Page 481 try it out lstew452 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 4 June 20th, 2010 02:35 PM
Chapter 14:Page 494 try it out Arya BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 March 18th, 2010 10:34 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





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