我正在尝试将数据库中的表添加到LINQ to SQL数据上下文中。它不会让我。在visual studio中查看设计器中的表,似乎没有将Id识别为主键。我看不出桌子有什么问题。任何想法都将不胜感激。
这是我的表格;
USE [fldt_bt_wbc]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[btRequests](
[ID] [int] IDENTITY(1,1) NOT NULL,
[UserID] [varchar](25) NOT NULL,
[RequestType] [int] NOT NULL,
[DateTime] [datetime] NOT NULL,
[Status] [varchar](20) NULL,
[ConversationID] [varchar](50) NULL,
CONSTRAINT [PK_btRequests] PRIMARY KEY CLUSTERED
(
[ID] 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
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[btRequests] WITH CHECK ADD CONSTRAINT [FK_btRequests_RequestType] FOREIGN KEY([RequestType])
REFERENCES [dbo].[RequestType] ([ID])
GO
ALTER TABLE [dbo].[btRequests] CHECK CONSTRAINT [FK_btRequests_RequestType]
GO
答案 0 :(得分:0)
感谢Pleun,我创建了一个干净的新项目并且它有效。