我写了这个函数,现在它总是返回true ...
任何人都可以帮助我吗?为什么这个T-SQL函数总是返回true?
Create FUNCTION dbo.ValidateBranch
(
@BranchID nvarchar(50),
@Password nvarchar(50)
)
RETURNS bit
AS
BEGIN
declare @Res bit
if exists(Select * From TPasswords Where (BranchID = @BranchID) and (isSecurity = 0) and (Pass = @Password))
set @Res = 1
else
set @Res = 0
RETURN @Res
END
,我callign像这样:
bool isValidBranch = taQueries.ValidateBranch(IDBranch, PasswordTextBox.Text) ?? false;
不知道,你尝试过在空表? – Benjol 2010-10-28 05:23:57
您需要将此问题的标题更改为有意义的内容。也许像'为什么这个T-SQL函数总是返回true?'。 – Dhaust 2010-10-28 05:25:48
@David:好的,谢谢你的指导...... – 2010-10-28 05:32:43