DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Returning Recordset from Stored Procedure

  1. #1
    Paul Guest

    Returning Recordset from Stored Procedure


    Hi

    I have got an 'sp' that builds a temporary table and eventually returns a
    recordset based on the data within this table.

    Executing through Query Analyser is fine, but when trying to do the same
    through ADO I'm getting and "Operation is not allowed when the object is
    closed" error.

    There seems to be an option of the Execute method that tells ADO that a stored
    procedure is not returning a recordset, but not one that explicitly tells
    it that one will be returning.

    Any ideas?

    Thanks

    Paul


  2. #2
    jfermin Guest

    Re: Returning Recordset from Stored Procedure


    Try to put
    set nocount on
    at the beginning of the stored proc and
    set nocount off
    before you perform the select.


    "Paul" <pa_sanders@hotmail.com> wrote:
    >
    >Hi
    >
    >I have got an 'sp' that builds a temporary table and eventually returns

    a
    >recordset based on the data within this table.
    >
    >Executing through Query Analyser is fine, but when trying to do the same
    >through ADO I'm getting and "Operation is not allowed when the object is
    >closed" error.
    >
    >There seems to be an option of the Execute method that tells ADO that a

    stored
    >procedure is not returning a recordset, but not one that explicitly tells
    >it that one will be returning.
    >
    >Any ideas?
    >
    >Thanks
    >
    >Paul
    >



  3. #3
    Adam Guest

    Re: Returning Recordset from Stored Procedure


    Hi,
    This sounds like the Connection object is not open prior to using the Execute
    method. It would be helpful to see a sample of the code you are using to
    execute the sp to better determine if this is causing the problem.

    -Adam

    "Paul" <pa_sanders@hotmail.com> wrote:
    >
    >Hi
    >
    >I have got an 'sp' that builds a temporary table and eventually returns

    a
    >recordset based on the data within this table.
    >
    >Executing through Query Analyser is fine, but when trying to do the same
    >through ADO I'm getting and "Operation is not allowed when the object is
    >closed" error.
    >
    >There seems to be an option of the Execute method that tells ADO that a

    stored
    >procedure is not returning a recordset, but not one that explicitly tells
    >it that one will be returning.
    >
    >Any ideas?
    >
    >Thanks
    >
    >Paul
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center