I have a stored procedure and often that procedure will return multiple rows, for example:
ID Type Price
1234 A 2.260
1234 B 2.690
1234 C 2.990
1234 D 2.690
1234 D 2.790
1234 D 2.650
1234 D 2.680
And I want to output the latest value for each type. In my data reader I have:
While dr.Read
result.price.TypeA= dr("price")
result.price.TypeB= dr("price")
result.price.TypeC= dr("price")
result.price.TypeD= dr("price")
End While
and my query looks like:
select sm_id,
type,
price
from ** WITH (NOLOCK)
where id = @id
order by id desc
I'm not sure how to store all of my results into my object so I can access them in my front end.
ROW_NUMBER()