Search code examples
stored-proceduresdatasettablename

DataSet stored procedure table names


I am calling a stored procedure to return two tables. I am getting it as a dataset in my console application. The table names in the dataset are something like TABLE,TABLE1.

Is there anyway to change this to a meaningful names from stored procedure?

Thanks, Mahesh


Solution

  • I don't think you can name DataTables from stored procedures.

    Of course it's easy to do this in code. In C# you can do the following, assuming a DataSet dataSet with two DataTables, one named TABLE and the other named TABLE1:

     dataSet.Tables["TABLE"].TableName = "MyBetterTableName";
     dataSet.Tables["TABLE1"].TableName = "AnotherTableName";
    

    and while you're at it, you can name your DataSet:

     dataSet.DataSetName = "MyDataSet";