RESULTSET PROBLEM

Discussion in 'ASP General' started by Savas Ates, Jun 3, 2005.

  1. Savas Ates

    Savas Ates Guest

    I have a stored procedure below.. When I run it with a well parameter in
    query analyser 3 of select statements return me. (i named select statements
    1,2,3)
    But in asp page when i call this procedure same as query analyser it returns
    me 2 select statements value? what is the problem ?


    CREATE PROCEDURE ST_25INDIRIM
    @sesid BIGINT
    AS


    IF EXISTS (SELECT 1 FROM sepet WHERE (adet=2 AND sesid=@sesid ) )
    BEGIN
    -1- SELECT * FROM sepet WHERE (adet=2 AND sesid=@sesid)
    END
    ELSE
    /*URUN SAYISI IKI TANE OLAN YOK VE ADETI BIR TANE OLAN EN AZ 2 URUN OLUP
    OLMADIGI KONTROLU*/
    BEGIN



    -2- SELECT * FROM sepet WHERE (adet =1 AND sesid=@sesid) ORDER BY id ASC


    IF (@@rowcount>=2 )
    BEGIN

    -3- SELECT TOP 1 * FROM sepet WHERE id IN (SELECT TOP 2 id FROM sepet
    WHERE (adet =1 AND sesid=@sesid) ORDER BY id ASC ) ORDER BY id DESC

    END



    END
    GO
    Savas Ates, Jun 3, 2005
    #1
    1. Advertising

  2. Savas Ates wrote:
    > I have a stored procedure below.. When I run it with a well parameter
    > in query analyser 3 of select statements return me. (i named select
    > statements 1,2,3)
    > But in asp page when i call this procedure same as query analyser it
    > returns me 2 select statements value? what is the problem ?
    >



    I don't understand why you think you should be getting 3 resultsets.
    Depending on the result of the first IF statement, you should be receiving
    either resultset 1 OR resultset 2. If you get resultset 2, then, if the last
    if statement is true, you will get resultset 3 as well. In other words, you
    will get one of these possibilities:

    resultset 1 only
    resultset 2 only
    resultset 2 and resultset 3 *

    I think you need to provide a create table statement and insert statements
    to provide sample data to help us to understand what your problem really is.

    Bob Barrows

    * In asp, you will need to use NextRecordset to get both resultsets - you
    should make it a habit to start your stored procedures with "SET NOCOUNT ON"
    to avoid getting extra resultsets containing informational messages
    returned:
    create someprocedure as
    set nocount on
    etc.

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Jun 3, 2005
    #2
    1. Advertising

  3. Maybe you have different ANSI_NULL settings, and you are calling the SP
    with @sesid IS NULL ?

    Gert-Jan


    Savas Ates wrote:
    >
    > I have a stored procedure below.. When I run it with a well parameter in
    > query analyser 3 of select statements return me. (i named select statements
    > 1,2,3)
    > But in asp page when i call this procedure same as query analyser it returns
    > me 2 select statements value? what is the problem ?
    >
    > CREATE PROCEDURE ST_25INDIRIM
    > @sesid BIGINT
    > AS
    >
    > IF EXISTS (SELECT 1 FROM sepet WHERE (adet=2 AND sesid=@sesid ) )
    > BEGIN
    > -1- SELECT * FROM sepet WHERE (adet=2 AND sesid=@sesid)
    > END
    > ELSE
    > /*URUN SAYISI IKI TANE OLAN YOK VE ADETI BIR TANE OLAN EN AZ 2 URUN OLUP
    > OLMADIGI KONTROLU*/
    > BEGIN
    >
    > -2- SELECT * FROM sepet WHERE (adet =1 AND sesid=@sesid) ORDER BY id ASC
    >
    > IF (@@rowcount>=2 )
    > BEGIN
    >
    > -3- SELECT TOP 1 * FROM sepet WHERE id IN (SELECT TOP 2 id FROM sepet
    > WHERE (adet =1 AND sesid=@sesid) ORDER BY id ASC ) ORDER BY id DESC
    >
    > END
    >
    > END
    > GO
    Gert-Jan Strik, Jun 3, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matrix
    Replies:
    0
    Views:
    573
    Matrix
    Apr 1, 2004
  2. matrix ¿ìÀÖÄñ

    How i know the size of "resultset"?

    matrix ¿ìÀÖÄñ, Apr 3, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,434
    matrix ¿ìÀÖÄñ
    Apr 3, 2004
  3. =?Utf-8?B?VGltX2s=?=

    Web Treeview loaded from resultset example

    =?Utf-8?B?VGltX2s=?=, Jun 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    338
    =?Utf-8?B?VGltX2s=?=
    Jun 18, 2004
  4. =?Utf-8?B?VGltX2s=?=

    Web Treeview loaded from resultset example

    =?Utf-8?B?VGltX2s=?=, Jun 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    257
    =?Utf-8?B?VGltX2s=?=
    Jun 18, 2004
  5. Joe via DotNetMonster.com

    Multiple Select Statements in resultset

    Joe via DotNetMonster.com, Mar 26, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    8,190
    Jim via DotNetMonster.com
    Mar 27, 2005
Loading...

Share This Page