【发布时间】:2016-08-24 09:58:18
【问题描述】:
string updatedVotes = string.Empty;
updatedVotes = updatedVotes.Substring(0, updatedVotes.Length - 1);
db.Entry(sch).State = EntityState.Modified;
sch.Rates = updatedVotes;
db.SaveChanges();
但是由于您在上面看到的错误,代码无法编译,我还没有完全理解为什么。有什么帮助吗?
【问题讨论】:
-
updatedVotes的类型为string。sch.Rates的类型为ICollection<Fast.Models.Reviews>。您不能像那样将不同类型的变量分配给彼此。那是 C# 101。
标签: c# asp.net-mvc