当我尝试以下代码时出现此错误
IEnumerable<DataRow> projjType = from projT in dtProjList.AsEnumerable()
where projT.Field<int?>("ProjectId") == projId &&
projT.Field<int?>("FilterId") == 1
select projT;
并且错误的堆栈跟踪是
at System.Data.DataRowExtensions.UnboxT`1.NullableField[TElem](Object value)
at System.Data.DataRowExtensions.Field[T](DataRow row, String columnName)
at Folder.Projects.<>c__DisplayClass28.<repProjectList_ItemDataBound>b__1e(DataRow projT) in D:\Folder\Project.aspx.cs:line 1061
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Linq.SystemCore_EnumerableDebugView`1.get_Items()
其中dtProjList是DataTable,表结构如下,
ProjectId (int)
ProjectName (string)
ProjectThumb (string)
FilterTypeId (int)
FilterId (int)
FilterType (string)
都不是空值。任何人都可以帮助我。
提前致谢。
更新::This is onlyrecord in my table,是因为单条记录的错误吗??
ProjectId ProjectName ProjectThumb FilterTypeId FilterId FilterType
1 Datamaster small_14.jpg 1 1 Final