asp.net 4.0: data access strategy for single stored procedure retuning multiple recordsets in web page
what is the recommended data access strategy for the following environ开发者_StackOverflow社区ment: single stored procedure, many parameters, asp.net 4.0, sql server 2008, and the stored proc returns 11 different recordsets, all of which get displayed in various different elements too complex and specific to be handled by server controls. Thoughts?
I would query the SP from the code behind to retrieve a SqlDataReader. Then dissect the data reader and assign the results to the asp.net data controls;
SqlDataReader myDataReader = com.ExecuteReader();
GridView1.DataSource = myDataReader;
GridView1.DataBind();
myDataReader.NextResult();
GridView2.DataSource = myDataReader;
GridView2.DataBind();
精彩评论