How can you name the Dataset's Tables you return in a stored proc?
As far as I know, from the stored proc, you can't do that. You can, however, set the names once you have retrieved the DataSet, and then use them from then on.
ds.Tables[0].TableName = "NametbA";
Stored procedure :
select 'tbA','tbB','tbC' select * from tbA select * from tbB select * from tbC
front-end:
int i = 1; foreach (string tablename in dsEmailData.Tables[0].Rows[0][0].ToString().Split(',')) { dsEmailData.Tables[i++].TableName = tablename; }
Hope this helps
Is there any reason you can't name them manually after filling the DataSet?
mySqlDataAdapter.Fill(ds);ds.Tables[0].TableName = "NametbA";ds.Tables[1].TableName = "NametbB";
I don't know of any way to name the DataTables that are returned as part of multiple result sets from a stored procedure, but if you know what the stored proc is returning then manually naming them should work fine.
Edit
Knowing that you have control over the stored procedure, one alternative might be to add a column to the result sets which represents the table name. Then you might be able to do something like:
foreach (DataTable table in ds.Tables){ table.TableName = table.Rows[0]["TableName"].ToString();}
However, this relies on the result sets coming back from the stored procedures actually containing rows. If they don't contain rows then you'd have to wrap it in an "if" statement and not every table would get a name.