bir datetime2 veri türü dönüştürülmesi bir denetleyiciniz:datetime veri tipi hata
[HttpPost]
public ActionResult Create(Auction auction)
{
var db = new EbuyDataContext();
db.Auctions.Add(auction);
db.SaveChanges();
return View(auction);
}
bir model:
public class Auction
{
public long Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public decimal StartPrice { get; set; }
public decimal CurrentPrice { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }}
}
ve bir görünüşüdür:
@model Ebuy.Website.Models.Auction
@using (Html.BeginForm())
{
<p>
//All the information fields...
@Html.LabelFor(model => model.EndTime)
@Html.EditorFor(model => model.EndTime)
</p>
}
Çalıştırmayı denedim Hata iletisini aldım:
The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.
Model denetleyici görünümü, kopyalanan bire bir kitaptan oluşur.
EndTime
alanına girmem gereken biçim nedir bu yüzden bu hatayı almayacağım?
StartTime ve EndTime için kaydedilen değerleri kontrol ettiniz mi? –