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)
Asked
Active
Viewed 407 times
0
-
Why dont you use ExecuteDataSet? Why do u insist on using ExecuteSprocAccessor? – Legends Jun 10 '16 at 15:05
-
Because I dont wanna convert again my DataSet into List i.e Enumberable objects ...I want to get directly mapped data objects – sudhir Jun 20 '16 at 18:09
1 Answers
0
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";

Legends
- 21,202
- 16
- 97
- 123