Student Student - 1 year ago 84
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download