Hello.
I have a stored procedure that returns 3 different resultsets. I'm dragging this stored proc into my dbml file and want to return all 3 different resultsets using IMultipleResults, however when I try to request my 2nd and 3rd resultsets, they for some reason, still only return the 1st resultset again. I need to be able to retrieve these 2nd & 3rd results.
Here's my code in my datacontext file:
[Function(Name="dbo.MyStoredProcName")]
[ResultType(typeof(InventoryTransactions))]
[ResultType(typeof(Shipments))]
[ResultType(typeof(Receipts))]
public IMultipleResults GetMultipleRs()
{
IExecuteResult result = this.ExecuteMethodCall(this, (MethodInfo) MethodInfo.GetCurrentMethod());
return (IMultipleResults) result.ReturnValue;
}
Then, I call it from one of 3 different methods. All 3 are listed below. The only difference between the 3 is each one attempts to return a different resultset (InventoryTransactions, Shipments, & Receipts):
public List<inventorytransactions> GetIlsInventoryTransactions(DateTime startDate, DateTime endDate)
{
List<inventorytransactions> transactions;
using (IlsDataContext dc = _conn.GetIlsTransactionContext())
{
IMultipleResults ret = dc.GetMultipleRs();
transactions = (from t in ret.GetResult<InventoryTransactions>()
where t.DateTimeStamp >= startDate && t.DateTimeStamp < endDate
select t).ToList();
}
return transactions;
}
public List<Shipments> GetIlsShipments(DateTime startDate, DateTime endDate)
{
List<Shipments> transactions;
using (IlsDataContext dc = _conn.GetIlsTransactionContext())
{
IMultipleResults ret = dc.GetMultipleRs();
transactions = (from t in ret.GetResult<Shipments>()
where t.DateTimeStamp >= startDate && t.DateTimeStamp < endDate
select t).ToList();
}
return transactions;
}
public List<Receipts> GetIlsReceipts(DateTime startDate, DateTime endDate)
{
List<Receipts> transactions;
using (IlsDataContext dc = _conn.GetIlsTransactionContext())
{
IMultipleResults ret = dc.GetMultipleRs();
transactions = (from t in ret.GetResult<Receipts>()
where t.DateTimeStamp >= startDate && t.DateTimeStamp < endDate
select t).ToList();
}
return transactions;
}</inventorytransactions></inventorytransactions>
--------------------------------------------------------------------------------
When I call any of these 3 methods, all 3 only return the data from the 1st resultset (InventoryTransactions). Any idea why I can't get the 2nd and 3rd ones?
Thanks.