Check If Stored Procedure Returns Value
Posted
by
Eric
on Stack Overflow
See other posts from Stack Overflow
or by Eric
Published on 2010-12-28T23:47:38Z
Indexed on
2010/12/28
23:54 UTC
Read the original article
Hit count: 129
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.
© Stack Overflow or respective owner