C# – Stored Procedure Returns Multiple Recordsets


I am pretty new to c#.
I have a page that requires multiple recordsets, and a single sproc that returns them. I am using a repeater control for the main recordset. How do I get to the next returned recordset?

OK so the datasource is in the aspx page. I would have move it to the code behind page to use NextResult right? Here is my code now. How do I move the datasource to the codebehind, implement a datareader so I can use nextresult?

<asp:SqlDataSource ID="AssetMgtSearch" runat="server" 
                ConnectionString="<%$ ConnectionStrings:OperationConnectionString %>" 
                SelectCommand="spAssetMgtItemList" SelectCommandType="StoredProcedure">
            <div class="contentListFullHeight">
                <table cellspacing="0" cellpadding="0" border="0" class="contentList">
                    <asp:Repeater ID="Repeater1" runat="server" DataSourceID="AssetMgtSearch">
                                <td colspan="3" style="border-top:solid thin blue">&nbsp;</td>

Best Solution

Call the NextResult() method on your reader to move to the next result.

No, you can't do this using SqlDataSource, you need to use codebehind or break up the procedure into separate queries.