不太明白“是否锁定”是什么意思?如果意思是没有锁定的用户才能登录,可以试试这个(直接写的,没有验证是否有错误):create procedure P_UserLogin(
@userName nvarchar(20),
@password nvarchar(20),
@ip nvarchar(15),
}
as
if exists(select 1 from [dbo].UsersTable where
user_Name=@userName and passwd=@password
and Locked=0)
begin
update [dbo].UsersTable set LoginTimes=loginTimes+1,
LastLoginIP=@ip
where user_Name=@userName
select 1 --通过验证
end
else
select 0 --未通过验证
go
@userName nvarchar(20),
@password nvarchar(20),
@ip nvarchar(15),
}
as
if exists(select 1 from [dbo].UsersTable where
user_Name=@userName and passwd=@password
and Locked=0)
begin
update [dbo].UsersTable set LoginTimes=loginTimes+1,
LastLoginIP=@ip
where user_Name=@userName
select 1 --通过验证
end
else
select 0 --未通过验证
go
解决方案 »
- 文章列表按月绑定怎么绑定呀~
- vs2010说“Microsoft.Practices.EnterpriseLibrary”中不存在类型或命名空间名称“Data”。是否缺少程序集引用?
- modalpopupextender 突出显示图片 并可以 打印
- 两台服务器上的DB数据同步。[50分起、追踪跟进继续补加]
- 手写的一个ajax类,为何在ie7.0运用时正常,在ie6.0发生错误,提示"对象不支持此属性或方法"
- DROPDOWNLIST老是漂在最上面一层,谁有代替DDLIST的控件? 1000分感谢!绝不食言.
- 求教,asp.net从客户端读取的数据是乱码
- 有一个参数未指定值????
- Asp.net 如何导入自定义命名空间?????
- 一个很奇怪的问题。。。。。高手帮忙呀。。在线等待啊!!先谢谢了。
- 受保护级别限制
- 急!这样通过控制端口的打开与关闭来控制电脑与internet的连接呢?
的意思是:如果这个用户被锁定了 就不能够登陆了 然后提示:该用户被锁定
@userName nvarchar(20),
@password nvarchar(20),
@ip nvarchar(15),
}
as
declare @isLocked bit
select @isLocked=Locked from [dbo].UsersTable where
user_Name=@userName and passwd=@password
if(@isLocked is null)
select 0 --未通过验证,注意Locked这个字段不能为null,只能为1或者0
else
if @isLocked=1
select 1 --通过验证,但用户被锁定
else
begin
update [dbo].UsersTable set loginTimes=loginTimes+1,
loginIP=@ip
where user_Name=@userName
select 2 --通过验证
end
go