When I tried the "Create" scaffold, I also can't input data into
database, it says the same error.
But if I enter the record manually in SQL Server, it is successful.I
can also select the record from database
For additional information, I enclose my view code, automatically
generated from visual studio:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/
Site.Master"
Inherits="System.Web.Mvc.ViewPage<IEnumerable<OmnipresentWebService.Models.Accommodation>>"
%>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent"
runat="server">
Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent"
runat="server">
<h2>Index</h2>
<table>
<tr>
<th></th>
<th>
ID
</th>
<th>
Name
</th>
<th>
Star
</th>
<th>
Price
</th>
<th>
Address
</th>
<th>
City
</th>
<th>
Province
</th>
<th>
Phone
</th>
<th>
Description
</th>
</tr>
<% foreach (var item in Model) { %>
<tr>
<td>
<%: Html.ActionLink("Edit", "Edit", new
{ id=item.ID }) %> |
<%: Html.ActionLink("Details", "Details", new
{ id=item.ID })%> |
<%: Html.ActionLink("Delete", "Delete", new
{ id=item.ID })%>
</td>
<td>
<%: item.ID %>
</td>
<td>
<%: item.Name %>
</td>
<td>
<%: item.Star %>
</td>
<td>
<%: String.Format("{0:F}", item.Price) %>
</td>
<td>
<%: item.Address %>
</td>
<td>
<%: item.City %>
</td>
<td>
<%: item.Province %>
</td>
<td>
<%: item.Phone %>
</td>
<td>
<%: item.Description %>
</td>
</tr>
<% } %>
</table>
<p>
<%: Html.ActionLink("Create New", "Create") %>
</p>
</asp:Content>