只选择我的表值 [英] select only my table value
本文介绍了只选择我的表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在使用登录表单.我想要的是只有那些用户才能登录
其记录在我们的数据库表中.
我为此尝试过存储过程,但无法放入逻辑.
求求我了.
荣誉
neaS
hi all,
i am working on a login form. what i want is only those user will be able to login
whose record is in our db table.
i tried stored procedure for this but not able to put logic.
please me out of this.
kudos
neaS
推荐答案
看看,
Sql Count.asp [ Sql哪里 [ ^ ]
因此逻辑将是,
Have a look,
Sql Count.asp[^]
Sql where[^]
So the logic will be ,
if( SELECT COUNT(*) FROM YOUR_TABLE WHERE USERNAME=USER_INPUT_USERNAME > 0 ) then
do something
else
No such user exists
希望对您有所帮助:)
Hope it helps :)
对于您可以使用的存储过程
for the stored procedure you can use
CREATE PROCEDURE [dbo].[SE_SelSecUserCredentials]
@UserName NVARCHAR(45),
@PassWord NVARCHAR(45)
AS
begin
SELECT
thefiels or count you need
FROM
UserTable
WHERE loginName = @UserName
AND BINARY_CHECKSUM(password) = BINARY_CHECKSUM(@PassWord)
end
我们对密码进行Binary_Checksum
以跟上密码的大小写.小写的大写字母不会给您结果(二进制值与A的值不同)
We do a Binary_Checksum
on the password to keep up with capitals in the password. a lower case for a capital will not give you a result (a in binary is different value than A)
这篇关于只选择我的表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文