When I put in @@Lower and @@Upper, it says I must declare the variables @@Lower and @@Upper. If I just use @Lower and @Upper, I still get the "Object reference not set to an instance of an object." error.
CREATE PROCEDURE sp_multiSelect
(
@Lower int,
@Upper int
)
AS
SELECT *
FROM MyLinks
WHERE dbID >= @Lower and dbID <= @Upper
RETURN @@Lower int,
RETURN @@Upper int
CREATE PROCEDURE sp_multiSelect
(
@Lower int,
@Upper int
)
AS
SELECT *
FROM MyLinks
WHERE dbID >= @Lower and dbID <= @Upper
RETURN @@Lower int,
RETURN @@Upper int
Ummm... what version of SQL Server are you using that lets you RETURN more than 1 value...? Beyond that, why would anyone want to RETURN the exact same value that they passed in in the first place?
The actual problem: (from MSDN) "Although the ExecuteNonQuery does not return any rows..." The data set is empty. Row 0 does not exist.
Hi,
You are trying to retrieve records between lower and upper values. You have to declare the input and output parameters in your SQL Procedure. You have 2 input parameters:
@Lower,
@Upper
You want to out put the fields from the record set so you need the parameters:
So your SQl Procedure should look like this:
Code:
CREATE PROCEDURE sp_multiSelect
(
@Lower int,
@Upper int’
@dbID int,
@Title varchar,
@URL varchar
)
AS
SELECT *
FROM MyLinks
WHERE dbID >= @Lower and dbID <= @Upper
RETURN @@dbID int,
RETURN @@Title varchar,
RETURN @@URL varchar
Originally posted by Ribeyed Hi,
You are trying to retrieve records between lower and upper values. You have to declare the input and output parameters in your SQL Procedure. You have 2 input parameters:
@Lower,
@Upper
You want to out put the fields from the record set so you need the parameters:
So your SQl Procedure should look like this:
Code:
CREATE PROCEDURE sp_multiSelect
(
@Lower int,
@Upper int’
@dbID int,
@Title varchar,
@URL varchar
)
AS
SELECT *
FROM MyLinks
WHERE dbID >= @Lower and dbID <= @Upper
RETURN @@dbID int,
RETURN @@Title varchar,
RETURN @@URL varchar
Bookmarks