Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 July 1st, 2009, 06:34 AM
Registered User
 
Join Date: Apr 2009
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default Ch 11Creating a relationship between tables

Hi, when I try and join the two databases, I get the follwing error message
'Genre' table saved successfully
'Review' table
- Unable to create relationship 'FK_Review_Genre'.
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_Review_Genre". The conflict occurred in database "C:\BEGASPNET\SITE2\APP_DATA\PLANETWROX.MDF", table "dbo.Genre", column 'Id'.

Any ideas?
 
Old July 1st, 2009, 07:34 AM
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,

Does your Review table already contain records? If so you need to delete them first (or change their GenreId to match with one of the Genre records).

The database enforces the relationship between the two tables, sees that one or more of the records cannot be matched and then stops you from creating the relation.

Hope this helps,

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 July 1st, 2009, 07:58 AM
Registered User
 
Join Date: Apr 2009
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi Imar
That was exactly the problem, I've been away from this for weeks and had lost track of what I had done.

Thanks very much





Similar Threads
Thread Thread Starter Forum Replies Last Post
relationship in PivotTable with diferents tables juliano_sb Visual Studio 2005 0 July 17th, 2008 09:44 AM
relationship with the two tables for Application W052107 ASP.NET 2.0 Professional 1 May 25th, 2007 03:15 AM
Tables Relationship itHighway Classic ASP Databases 1 August 22nd, 2005 12:16 AM
tables relationship through coding itHighway Classic ASP Basics 2 May 3rd, 2005 06:39 PM





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