0
我需要用口不重复的记录,但我有一个错误:鲜明的嘴LINQ2SQL
Column "data" does not exist.
Server Error in '/' Application.
Column "data" does not exist.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Column "data" does not exist.
Source Error:
Line 14: var grid = new WebGrid(ViewBag.dat ,null, "Dates", 8);
Line 15: }
Line 16: @grid.GetHtml(
Line 17: tableStyle: "grid",
Line 18: headerStyle: "head",
我的控制器:
var d = (from b in baza.hours
where b.userID == userID
select new { b.data.Month }).Distinct();
ViewBag.dat = d;
而我的观点:
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
@{
var grid = new WebGrid(ViewBag.dat ,null, "Dates", 8);
}
@grid.GetHtml(
tableStyle: "grid",
headerStyle: "head",
alternatingRowStyle: "alt",
columns: grid.Columns(
grid.Column("data","Dates")
)
)
</fieldset>
}
如何解决?
如果您可能包含您收到的错误,将会很有帮助。 – 2012-01-09 22:57:19
我的猜测是你的专栏是日期不是数据..仔细检查你的linq – 2012-01-09 22:58:41
@PhilKlein我把错误。 @BassamMehanni,这不是一个问题:)当我使用'b.data'而不是'b.data.Month'一切正常。数据是电子波兰名称日期,列是电话数据。 – user1031034 2012-01-09 23:09:43