Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 3rd, 2006, 05:34 PM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Return 2 Recordsets from 1 Stored Proc

Hi there,
I am trying to run the following stored proc from asp.net 2.0 and have two record sets returned.

How do i go about doing this? Is it possible?

If I execute the SP on SqlServer it returns 2 recordsets as i want... Just unsure about asp.net. I realize I could use 2 stored procs to achieve the same thing but want to know how to do it with one.

thanks :)

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[spgGetCreditorControl]
    (
    @CreditorID int,
    @StartDate DateTime,
    @EndDate DateTime
    )

AS
BEGIN
    SET NOCOUNT ON;

    SELECT PurchaseInvSummary.Date AS PurchaseDate,
           PurchaseInvSummary.Reference AS PurchaseRef,
               PurchaseInvSummary.Gross AS PurchaseGross,
               Customer.Name

    FROM PurchaseInvSummary INNER JOIN
           Customer ON (PurchaseInvSummary.CreditorID = Customer.ID)
    WHERE (PurchaseInvSummary.CreditorID = @CreditorID) AND
           (Date >= @StartDate) AND
           (Date <= @EndDate)

    SELECT [Transaction].Date AS TransactionDate,
           [Transaction].Narrative AS TransactionNarrative,
           [Transaction].Amount AS TransactionAmount

    FROM [Transaction] INNER JOIN
           AccountType ON [Transaction].AccountID = AccountType.AccountID
    WHERE AccountType.CustomerID = @CreditorID AND
           [Transaction].Date >= @StartDate AND
           [Transaction].Date <= @EndDate

END






Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling an insert stored proc from a select stored dzitam SQL Language 10 April 2nd, 2007 12:39 PM
Storing return value of a Stored Proc in a Session mahajanvit ASP.NET 2.0 Basics 0 November 2nd, 2006 10:16 AM
problem with a stored proc trying to return blobs Phrozt SQL Server 2000 2 May 12th, 2006 09:36 AM
Return output variable to VB from SQL stored proc busterbunny BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 March 27th, 2006 10:24 PM
Using recordsets in Stored Procedures MaxGay SQL Server 2000 3 February 25th, 2005 11:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.