Returning two tables at once

  • Thread starter Thread starter Simon Harvey
  • Start date Start date
S

Simon Harvey

Hi chaps,

I was wondering if it is possible to make execute one stored procedure and
get more than one table back.

I particular, what I'm looking to do is get a some info from a primary
table, and then all the related info from a foreign table.

I'd like to put these two tables into a dataset. I'm just wondering if I
have to make two seperate calls to stored procedures to get my two tables,
or whether this can be done in a oner.

Many thanks all

Simon
 
Hi Simon,

Yes, it is supported there is IDataReader.NextResult method which Fill
internally uses.
 
Hello,
A stored procedure contains normal sql statements. That means you can select
different fields from different tables.
Select table1.Id,table2.Name from table1,table2
Where table2.custId=table1.Id
In that case you'll only call it once. Adjust your output parameters to fit
into the result you want to get from the stored procedure.
 
Back
Top