Last post Jun 04, 2011 12:01 AM by Decker Dong - MSFT
Jun 02, 2011 02:13 PM|feelexit126|LINK
I am using ObjectDataSource to select the "Survey" based on the SurveyID and this survey's related info.
this is my stored procedure.
ALTER PROCEDURE [dbo].[GetSurveyByID]
SET NOCOUNT ON;
SELECT * from Survey where SurveyID = @SID
Select * from Page where SurveyID = @SID
This is very simple, just 2 select statement. I am hoping to get a dataset returned back with 2 tables in it. but seems like ObjectDataSource only return one DataTable at a time. right now, I have to create 2 ObjectDataSource controls to get the job done. This is not so bad, but my other pages, i need to return 7, 8 tables, I dont want to create 7, 8 ObjectDataSource Controls for just one page.
What should I do? pleaes help.
this is my select function. I am using enterpise library 5.0
public DataSet GetSurveyByID(long SID)
DbCommand dbCmd = _db.GetStoredProcCommand("GetSurveyByID");
_db.AddInParameter(dbCmd, "SID", DbType.Int32, SID);
Jun 03, 2011 12:06 AM|Shakti Singh Tanwar|LINK
Use TableAdapters instead
Jun 04, 2011 12:01 AM|Decker Dong - MSFT|LINK
For multiple tables. I think you'd better use DataSet, which is container that will hold several tables' contents together.
Plese do not use any data objects in this situation, and instead, just use SqlDataAdapter to fetch seval tables' data contents into the same DataSet.
And then bind one by one——
GridView1.DataSource = DataSet.Tables;
GridView2.DataSource = DataSet.Tables;