473,804 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stored Procedure Help

MDB
Hello all, I know this may not be the correct group but was hoping someone
could help anyway. I have a stored procedure that is not returning the
correct information. For some reason it is not returning the correct lane or
reference number and was wondering if someone can take a look and help
figure out why.

Here is the asp.net code:

OleDbCommand cmd = new OleDbCommand ( "Get_CCAuth_Lan e", conn );
cmd.CommandType = CommandType.Sto redProcedure;
OleDbParameter dbLane = cmd.Parameters. Add("@Lane_Nbr" ,OleDbType.Inte ger);
dbLane.Directio n = ParameterDirect ion.ReturnValue ;
OleDbParameter dbRefNbr =
cmd.Parameters. Add("@Last_Refe rence_Nbr",OleD bType.Integer);
dbRefNbr.Direct ion = ParameterDirect ion.ReturnValue ;

dr = cmd.ExecuteRead er ( );
dr.Close();

string sLane = dbLane.Value.To String();
string sRefNbr = dbRefNbr.Value. ToString();

This is returning 0 as lane number when it should be 1 and 1 as sRefNbr
where it should be 555.
Here is the stored procedure:

ALTER Procedure pmmobile.Get_CC Auth_Lane (out @lane_nbr int, out
@Last_Reference _Nbr int)
begin

DECLARE @CurrentTime DateTime;
set @CurrentTime = now(*);

getloop:
WHILE datediff(Second ,@CurrentTime, now(*)) < 30 LOOP
Select FIRST(Lane_Nbr) , Last_Reference_ Nbr
INTO @lane_nbr, @Last_Reference _Nbr
FROM ccauth_lane WHERE status = 'I' or datediff(Minute , last_accessed,
now(*)) >= 2;

IF @lane_nbr IS NOT NULL THEN
UPDATE ccauth_lane SET status = 'A', last_accessed = now(*) where lane_nbr
= @lane_nbr AND (status = 'I' or datediff(Minute , last_accessed, now(*)) >=
2);
IF @@ROWCOUNT = 1 THEN
return;
END IF;
END IF;
END LOOP;
SET @lane_nbr = -99;
SET @Last_Reference _Nbr = -99;
END
Jun 21 '06 #1
1 1084
MDB
Figured it out, thanks for anyone who looked.

Had the Direction set wrong.......
"MDB" <md*@nowhere.co m> wrote in message
news:uJ******** ******@TK2MSFTN GP05.phx.gbl...
Hello all, I know this may not be the correct group but was hoping someone
could help anyway. I have a stored procedure that is not returning the
correct information. For some reason it is not returning the correct lane
or reference number and was wondering if someone can take a look and help
figure out why.

Here is the asp.net code:

OleDbCommand cmd = new OleDbCommand ( "Get_CCAuth_Lan e", conn );
cmd.CommandType = CommandType.Sto redProcedure;
OleDbParameter dbLane = cmd.Parameters. Add("@Lane_Nbr" ,OleDbType.Inte ger);
dbLane.Directio n = ParameterDirect ion.ReturnValue ;
OleDbParameter dbRefNbr =
cmd.Parameters. Add("@Last_Refe rence_Nbr",OleD bType.Integer);
dbRefNbr.Direct ion = ParameterDirect ion.ReturnValue ;

dr = cmd.ExecuteRead er ( );
dr.Close();

string sLane = dbLane.Value.To String();
string sRefNbr = dbRefNbr.Value. ToString();

This is returning 0 as lane number when it should be 1 and 1 as sRefNbr
where it should be 555.
Here is the stored procedure:

ALTER Procedure pmmobile.Get_CC Auth_Lane (out @lane_nbr int, out
@Last_Reference _Nbr int)
begin

DECLARE @CurrentTime DateTime;
set @CurrentTime = now(*);

getloop:
WHILE datediff(Second ,@CurrentTime, now(*)) < 30 LOOP
Select FIRST(Lane_Nbr) , Last_Reference_ Nbr
INTO @lane_nbr, @Last_Reference _Nbr
FROM ccauth_lane WHERE status = 'I' or datediff(Minute , last_accessed,
now(*)) >= 2;

IF @lane_nbr IS NOT NULL THEN
UPDATE ccauth_lane SET status = 'A', last_accessed = now(*) where
lane_nbr = @lane_nbr AND (status = 'I' or datediff(Minute , last_accessed,
now(*)) >= 2);
IF @@ROWCOUNT = 1 THEN
return;
END IF;
END IF;
END LOOP;
SET @lane_nbr = -99;
SET @Last_Reference _Nbr = -99;
END

Jun 21 '06 #2

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

Similar topics

4
10907
by: Michael Trosen | last post by:
Hi Everyone, I hope someone can help, I'm pretty new to pro*c programming. I have the following application setup: a pro*c program calls a stored procedure and recieves a cursor back: the cursor is defined as: SQL_CURSOR delpt_cursor
3
22151
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my application server can talk to the database. I've determined the failure occurs when the the following statement is executed: cstmt.execute(); (due to the failure of println statements placed afterwards). I get the following error after trying to...
3
6590
by: Jarrod Morrison | last post by:
Hi all Im relatively new to using stored procedures and im not sure if it is possible to do what I am trying to do so any help here is greatly appreciated. I am using the variable @MachineName which is obviously the local machine name mainly in this procedure. What is loop through from the first character of the variable to the last and use this data in a select statement. I have included the code below for what I have tried so far but I...
7
1626
by: Douglas Buchanan | last post by:
I can't seem to open SQLS2k Stored Procedures in the IDE I am running MDE 2003 Version 7.1.3088 I have a MSDN professional subscription and did a complete install of vs.net Help explains how to do it: 1. In Server Explorer, expand the Stored Procedures folder. 2. Double-click the name of the stored procedure you want to open.
4
13472
by: marc | last post by:
I've been developing a stored procedure that uses a user defined function in the query portion of the procedure. However, since the end product needs to allow for dynamic table names, the UDF will not work. I've been trying to get this to work with converting the UDF to a procedure, but I'm having no luck. Here is the background on what I'm trying to accomplish. I need to perform a sub-identity on a table, I have the normal identity set,...
3
2810
by: Rhino | last post by:
I've spent the last couple of hours trying to figure out how to debug a Java stored procedure and am just going in circles. The last straw came when I got "Cannot open input stream for default" when I launched the IBM Distributed Debugger via D:\IBMDebug>idebug.exe -qdaemon -quiport=8000,8001 First, a bit of background. I am running DB2 V7.2 with Fixpack 9 applied on Windows XP Professional (all critical service applied). I've written...
5
2844
by: microsoft.private.windows.netserver.setup | last post by:
I have a very strange thing occurring in the program. I have a dataset retrieved from a stored procedure that just select * from a table. I then try to use the SQlCommandBuilder on the dataset, and fails. I try the same select statement directly and not using a stored procedure and use SQLCommandBuilder, the program works. This is a ASP.net page, and I am stumped. I would like to use the stored procedure rather than controlling it in...
7
5846
by: eholz1 | last post by:
Hello PHP group, Could someone help me out? I have PHP 5.2, Apache 2.0, and MySQL 5.0 running on Linux (Redhat Fedora Core 6). All that works fine. I would like to be able to "call" a stored procedure from a PHP program, and run a stored procedure. I have yet to figure out the proper way to do this. My stored procedures work fine from the mysql command line using syntax: "call sp_min_record (101);"
9
8990
by: jyothi1105 | last post by:
Hi all, Here is some information which could help people who want to create stored procedures and execute them in their program. You can create stored procedures in two ways: Through front end or writing procedure from backend SQLServer. Back End First we'll cover how to write a stored procedure in back end. The following example is how to create a store procedure for MSSql Server:
0
3194
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works fine. Now we decided to move from mainframe IMS-DB2 to Windows 2003 server-DB2 UDB for LUW 9.5.
0
9711
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10343
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7633
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.