Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
Old August 22nd, 2010, 04:55 AM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #3 (permalink)  
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.
Reply With Quote
  #4 (permalink)  
Old August 22nd, 2010, 06:59 AM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #5 (permalink)  
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.
Reply With Quote
  #6 (permalink)  
Old August 22nd, 2010, 07:20 AM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #7 (permalink)  
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!
Reply With Quote
  #8 (permalink)  
Old August 22nd, 2010, 07:48 AM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:32 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.