我试图将数据添加到SQL Server中的Event表中。 这是表格的详细信息:
CREATE TABLE [dbo].[Event]
(
[EventID] [int] IDENTITY(1001,1) NOT NULL,
[EventName] [nvarchar](50) NOT NULL,
[EventDesc] [nvarchar](50) NOT NULL,
[EventLogo] [image] NULL,
[EventLocation] [decimal](9, 6) NULL,
[EventDate] [nvarchar](20) NOT NULL,
[EventStartTime] [nvarchar](7) NOT NULL,
[EventEndTime] [nvarchar](7) NOT NULL,
[NumOfAttendees] [nvarchar](7) NULL,
[EventStatus] [nvarchar](5) NOT NULL,
[UserID] [int] NULL,
[CategoryID] [int] NULL,
[RatingID] [int] NULL,
[FeedbackID] [int] NULL
)
这是我收到错误的地方:
在逐字说明符@
之后预期的关键字,标识符或字符串
这是EventController
代码:
public ActionResult Index()
{
var events = db.Events.Include(@ => @.Category).Include(@ => @.Feedback).Include(@ => @.Rating).Include(@ => @.User);
return View(events.ToList());
}
答案 0 :(得分:1)
将其更改为 -
{{1}}
@是一个用于逐字文字的关键字。