M
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_Lane", conn );
cmd.CommandType = CommandType.StoredProcedure;
OleDbParameter dbLane = cmd.Parameters.Add("@Lane_Nbr",OleDbType.Integer);
dbLane.Direction = ParameterDirection.ReturnValue;
OleDbParameter dbRefNbr =
cmd.Parameters.Add("@Last_Reference_Nbr",OleDbType.Integer);
dbRefNbr.Direction = ParameterDirection.ReturnValue;
dr = cmd.ExecuteReader ( );
dr.Close();
string sLane = dbLane.Value.ToString();
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_CCAuth_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
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_Lane", conn );
cmd.CommandType = CommandType.StoredProcedure;
OleDbParameter dbLane = cmd.Parameters.Add("@Lane_Nbr",OleDbType.Integer);
dbLane.Direction = ParameterDirection.ReturnValue;
OleDbParameter dbRefNbr =
cmd.Parameters.Add("@Last_Reference_Nbr",OleDbType.Integer);
dbRefNbr.Direction = ParameterDirection.ReturnValue;
dr = cmd.ExecuteReader ( );
dr.Close();
string sLane = dbLane.Value.ToString();
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_CCAuth_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