How can you name the Dataset's Tables you return in a stored proc?

Solution 1:

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";

Solution 2:

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