You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Hi Experts:
I met a problem when trying to pass two parameters to SQL storedprocedure in C# programme.
Here is the definition of the storedprocedure:
CREATE PROC product_proc;1
(@d_salary int,@u_salary int)
AS
IF @d_salary IS NULL
BEGIN
PRINT 'offer minimum salary'
RETURN -1
END
IF @u_salary IS NULL
BEGIN
PRINT 'offer maximum salary'
RETURN -2
END
IF @u_salary < @d_salary
BEGIN
PRINT 'maximum salary<minimum salary!'
RETURN -3
END
IF NOT EXISTS (SELECT * FROM Product WHERE price BETWEEN @d_salary AND @u_salary)
BEGIN
PRINT 'No records!'
RETURN -100
END
SELECT * FROM Product WHERE price>@d_salary AND price<@u_salary
RETURN 0
How to pass the two parameters "d_salary " and "u_salary" in C# programme?
part of the C# programme: