Check If Stored Procedure Returns Value
- by Eric
Hello all, I am using Linq 2 Sql in VS 2010, and I have the following stored procedure to check a username and password
ALTER PROCEDURE dbo.CheckUser
(
@username varchar(50),
@password varchar(50)
)
AS
SELECT * FROM Users Where UserName=@username AND Password=@password
The problem I'm having is that it throws an exception if the username and password are incorrect. I'd like to perform a check to see if there is a return value, rather than using try/catch to determine whether the procedure returned a value.
Should I do this check in code (C#)? Or is there a way to do it in SQL?
Thanks.