473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

RESULTSET PROBLEM

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
Jul 22 '05 #1
2 1761
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"
Jul 22 '05 #2
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

Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: RoyalScorpion | last post by:
hi guys, i get an updatable resultset from a connection then used it to insert a new row but the result set doesn't chane after insertion, i mean the no of rows before insertion is the same after...
7
by: Gandalf | last post by:
Hi all, I am connecting to DB2 8.1 on Solaris through JDBC type 4 drivers (driver: com.ibm.db2.jcc.DB2Driver). Problem is that when a cursored query is done, the resultset gets closed after...
5
by: xixi | last post by:
hi, we are running db2 udb on v8.1, i am using jdbc sql, is there anyway to create a sql saying i want to get the last record of resultset? i try to open a big resultset and point the cursor to the...
3
by: Koen | last post by:
Hi, first of all, the machine setup server 1: - UDB2 7.2.5; COUNTRY=1, location = US, IBM1250 codepage - Locale: US English; Regional Settings: English; Keyboard: Dutch; decimal separator: ....
1
by: rafikki3 | last post by:
I have a java web application that is using the db2jcc driver to get a connection to a DB2 database that is located on an RS 6000 server. The here is a portion of the code that is giving me a...
4
by: _link98 | last post by:
Problem: java ResultSet cursor from SQL/PL stored-procedure is FORWARD_ONLY. Is it possible to have ResultSet cursors from SQL/PL procedures to scroll forward and backwards? Perhaps I am missing...
12
by: robertino | last post by:
Hi all, I've put together a few SPs to produce a BOM (bill of materials) listing, which together use a couple of global temp tables, and return the results from a cursor. Here's the code: ...
0
by: David Linsin | last post by:
I created a simple test case to reproduce the problem (also check Bug #15500): import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement;...
5
by: lost1 | last post by:
I am having trouble adding a result set to a scroll pane. no matter what I do using getText I get an error. Can someon give me a clue? import java.util.*; import java.sql.*; import java.awt.*;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.