locked
Linq and stored procs with multiple result sets RRS feed

  • Question

  • User1085970526 posted

    I tried to use linq to sql to get data from my stored procedures, but it only returns the first recordset. Is there any way to change this? Even better, how about creating relationships in the objects generated by the results?

    Monday, January 14, 2008 12:26 PM

Answers

All replies

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 14, 2008 12:30 PM
  • User1085970526 posted

    That article doesn't seem to be about multiple recordsets

    Say I had a sproc like this:

    create proc usp_getOrder @orderNo int

    select * from ordertable where orderno= @orderNo

    select * from address where orderNo = @orderNo

    select * from litem where orderNo = @orderNo

    This will hit the DB once and return three recordsets.

    I'd love for it to return a nice, hierarchical tree of objects so I could do something like this:

    lblState.Text = myOrder.Address.State;

    Of course, I'm lazy so I want the framework to do as much of this as possible for me because I don't want to write lots of code that I'll need to maintain later.

    Friday, January 18, 2008 5:45 PM