[英]Why does i cant bind the datasource to my datagridview with result from stored procedure?
The result of the stored procedure is a collection of items ( IEnumerable<T>
/ IQueryable<T>
). 存储过程的结果是项的集合(
IEnumerable<T>
/ IQueryable<T>
)。 When you perform FirstOrDefault
you retrieve the first item in the collection or default(T)
if collection is empty. 当执行
FirstOrDefault
将检索集合中的第一项;如果collection为空,则检索default(T)
。
The T
that you have is not an IEnumerable<T>
but an object representing a single record with 3 properties, so you do not have the ToList()
extension method. 您拥有的
T
不是IEnumerable<T>
而是一个对象,该对象表示具有3个属性的单个记录,因此您没有ToList()
扩展方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.