Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Foreign key problem
Message
De
06/02/2010 02:49:07
 
 
À
05/02/2010 18:26:05
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Versions des environnements
Environment:
ASP.NET
Divers
Thread ID:
01447781
Message ID:
01447889
Vues:
27
Ok

I'm working through (or trying to)

http://nerddinnerbook.s3.amazonaws.com/Part2.htm

I still have a problem creating the db from within Visual Studio (Its looking for 2005) so I created it in the SQL Management Studio no problems
But when I drag the tables from the server explorer into the dbml I didn't get the FK in the dbml designer diagram

below is the code creating the tables in sql


USE [NerdDinner]
GO

/****** Object: Table [dbo].[Dinners] Script Date: 02/06/2010 07:44:09 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Dinners](
[DinnerId] [int] IDENTITY(1,1) NOT NULL,
[Title] [nvarchar](50) NOT NULL,
[EventDate] [datetime] NOT NULL,
[Description] [nvarchar](max) NOT NULL,
[HostedBy] [nvarchar](20) NOT NULL,
[ContactPhone] [nvarchar](20) NOT NULL,
[Address] [nvarchar](50) NOT NULL,
[Country] [nvarchar](30) NOT NULL,
[Latitude] [float] NOT NULL,
[Longitude] [float] NOT NULL,
CONSTRAINT [PK_Dinners] PRIMARY KEY CLUSTERED
(
[DinnerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

USE [NerdDinner]
GO

/****** Object: Table [dbo].[RSVP] Script Date: 02/06/2010 07:44:40 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[RSVP](
[RsvpId] [int] IDENTITY(1,1) NOT NULL,
[DinnerId] [int] NOT NULL,
[AttendeeName] [nvarchar](30) NOT NULL,
CONSTRAINT [PK_RSVP] PRIMARY KEY CLUSTERED
(
[RsvpId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[RSVP] WITH CHECK ADD CONSTRAINT [FK_RSVP_Dinners] FOREIGN KEY([DinnerId])
REFERENCES [dbo].[Dinners] ([DinnerId])
GO

ALTER TABLE [dbo].[RSVP] CHECK CONSTRAINT [FK_RSVP_Dinners]
GO
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform