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
  #1 (permalink)  
Old September 4th, 2011, 12:56 PM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Problem in Chapter 14

Hiya,

I have been having an issue with Chapter 14 where when I try to do the Try it Outs with the Photo Album I am getting the following error:

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Picture_PhotoAlbum". The conflict occurred in database "C:\USERS\IANWINDOWS7\DOCUMENTS\FINAL YEAR PROJECT\TRAINING MATERIAL\BEGINNING ASP.NET AND C# 4.0\SITE\APP_DATA\PLANETWROX.MDF", table "dbo.PhotoAlbum", column 'Id'.
The statement has been terminated.

I have managed to successfully load the source files, and they work, and the database this is referencing is the one provided in the source files. Can anyone offer a solution?

I am also using the source code files for the ManagePhotoAlbum.aspx page as well.
  #2 (permalink)  
Old September 4th, 2011, 12:59 PM
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,

A few things to check:

1. The relationships between the two tables in the database. Which columns are they joined on?

2. The ID of the album that is passed from NewAlbum to ManageAlbum. Do you see the correct ID in the query string?

Finally, storing a site in such a long path and with a # in its name will get you in problems later. Try moving it to a folder such as C:\Sites\

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!
The Following User Says Thank You to Imar For This Useful Post:
scrappy1871 (September 4th, 2011)
  #3 (permalink)  
Old September 4th, 2011, 01:08 PM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Imar,

Thank-you so much for your very quick reply. Really appreciated.

I have now resolved the issue, turns out I had mistyped the query string in the NewPhotoAlbum.aspx.cs and had put "PhototAlbumId" rather than "PhotoAlbumId".

I will bare that in mind regarding the folder names.

Excellent book by the way. Has taught me so much!
  #4 (permalink)  
Old September 4th, 2011, 02:49 PM
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

Ah, yes, that explains it. That would result in a PhotoAlbumId of 0 which doesn't exist in the database.

Quote:
Excellent book by the way. Has taught me so much!
Good to hear; thanks!

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: Caching problem dbcook8 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 4 October 19th, 2008 10:46 AM
Problem : Sketcher in chapter 14 chang82 BOOK: Ivor Horton's Beginning Visual C++ 2005 1 September 8th, 2008 02:29 AM
Chapter 14 - use of CObject problem jabuck BOOK: Ivor Horton's Beginning Visual C++ 2005 0 February 15th, 2007 02:25 PM
Problem with code on Chapter 14 aargyri BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 3 June 6th, 2006 03:37 PM
chapter 14 Try It Out problem - update Jams30 BOOK: Beginning ASP 3.0 1 March 22nd, 2004 12:59 PM





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