Tech Off Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Multiple tables from a single sproc

Back to Forum: Tech Off
  • User profile image
    W3bbo

    Consider this sample sproc

    
    CREATE PROCEDURE dbo.Sproc
    
    @ID bigint
    
    AS
    
    SELECT * FROM tblFoo WHERE [ID] = @ID
    
    SELECT * FROM tblBar WHERE [IRTID] = @ID
    
    SELECT * FROM tblBaz WHERE [Blargh] = @ID
    
    


    How do I capture all 3 returned tables with ADO.NET?

  • User profile image
    Maurits

    ADODB: rs.NextRecordset
    ADODataReader:
        if (d.HasMoreResults())
        {
            d.NextResult();
        }

  • User profile image
    mjnagpal

    Dataset.Tables[0] Dataset.Tables[1] Dataset.Tables[2]

  • User profile image
    Shrage

    If you use a DataReader  then you loop:

       dr.Read()

    then move to the next table

       dr.NextResult()

    then loop again

       dr.read

    If you use a DataAdapater to fill a datatable you write as mjnagpal  says:

       Dataset.Tables[0]    Dataset.Tables[1]    Dataset.Tables[2]

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.