I'm using ExecuteSprocAccessor to retrieve data , it is working fine when returning a single datatable i.e I can convert in to my custom IEnumerable object ExecuteSprocAccessor but my SP returns multiple tables how to collect that ?? Is it possible to return multiple tables?? (as we do using ExecuteDataSet)

1

There are 1 best solutions below

0
On

The following works:

public DataSet GetComponentHistory()
{
    string sqlCommand = "YourSpName";
    Database _db = DatabaseFactory.CreateDatabase();

    DbCommand dbCommand = _db.GetStoredProcCommand(sqlCommand);
    DataSet ds = _db.ExecuteDataSet(dbCommand);

    return ds;
}

Make sure you have "MultipleActiveResultSets" enabled in your connection string.

string connectionString = "Data Source=MSSQL1;Initial Catalog=AdventureWorks;Integrated Security=SSPI;MultipleActiveResultSets=True";