Student Student - 4 months ago 29
C# Question

Why does i cant bind the datasource to my datagridview with result from stored procedure?

My SP :
enter image description here

My C#:
enter image description here

I can't get method

for datasource in datagridview, how to solve this?


The result of the stored procedure is a collection of items (IEnumerable<T>/IQueryable<T>). When you perform FirstOrDefault you retrieve the first item in the collection or default(T) if collection is empty.

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.

Please refer to SO Linq FirstOrDefault Documentation to understand more