returning many datasets from a single stored procedure

  • Thread starter Thread starter Constantin
  • Start date Start date
C

Constantin

Hello,

I've been told that it is possible to get back multiple data sets from
the same stored procedure. A practical application to this is
returning a count(*) in the first select statement and returning the
actual data in the second dataset.

Is it possible to do this? I thought a SP only returns one object...

Any suggestions / code examples are greatly appreciated.


C
 
Reviewing my post I see that made an error in my
example. Here is the correct version:

For example
SELECT Count(*) FROM Customers;
SELECT * FROM Customers

Javed
 
Hi,

Just to add a few notes to the previous reply :

You return a single dataset but with many tables or many resultsets. I do
that with my Oracle managed provider.
Then I do the following to get two views :
1-dataview1=mySingleDataset.tables(0).defaultview 'Returns the count value
view
2-dataview1=mySingleDataset.tables(1).defaultview 'Returns the select value
view

So now you can do whatever you want with your two views (code in vb):
Dim intCount as integer=0
If dataview1.count>0 Then
intCount =dataview1.Item(0).Item("Count_FieldName")
End if

Etc...
 
Back
Top