请兄弟们帮个忙~!存储过程问题~!
下面是一个会员登陆的存储过程
该过程运行正常~!,我想在这上面加上一个小功能,不知道怎么做
小弟没怎么学过存储过程,请大哥大姐们帮忙,小弟先谢过,70分全部送出~!,一分不留!
下面的存储过程实现了,用户登陆出现的用户名错误,密码错误,用户是否帐号被锁
我想在这基础上加上:
登陆成功以后,同时更新登陆时间(字段为:logintime) = 现在的时间;
登陆成功以后,更新字段ABC=ABC+1(字段ABC为数据型),如果一天内登陆次数超过五次,就不再加1,但登陆时间是每次登陆都要更新的.
CREATE PROCEDURE login
@txtUserName varchar(50),
@txtUserPass varchar(50)
AS
declare @key int
set @key=0/* 0-此帐号被锁*/
declare @out varchar(50)
if not exists(select * from G_UserList where G_UserName=@txtUserName)
begin
set @out=-1
end
else
begin
if not exists(select * from G_UserList where G_UserName=@txtUserName and G_UserPass=@txtUserPass)
begin
set @out=-2
end
else
begin
if exists(select * from G_UserList where G_UserName=@txtUserName and G_UserPass=@txtUserPass and G_Flag=@key)
begin
set @out=-3
end
else
select @out=G_id from G_UserList where G_UserName=@txtUserName and G_UserPass=@txtUserPass
end
end
return @out
GO
------解决方案--------------------CREATE PROCEDURE login
@txtUserName varchar(50),
@txtUserPass varchar(50)
AS
declare @key int
set @key=0/* 0-此帐号被锁*/
declare @out varchar(50)
if not exists(select * from G_UserList where G_UserName=@txtUserName)
begin
set @out=-1
end
else
begin
if not exists(select * from G_UserList where G_UserName=@txtUserName and G_UserPass=@txtUserPass)
begin
set @out=-2
end
else
begin
if exists(select * from G_UserList where G_UserName=@txtUserName and G_UserPass=@txtUserPass and G_Flag=@key)
begin
set @out=-3
end
else
select @out=G_id from G_UserList where G_UserName=@txtUserName and G_UserPass=@txtUserPass
update G_UserList set logintime = GETDATE() where G_UserName=@txtUserName
end
end
return @out
GO
------解决方案--------------------CREATE PROCEDURE login
@txtUserName varchar(50),
@txtUserPass varchar(50)
AS
declare @key int
set @key=0/* 0-此帐号被锁*/
declare @out varchar(50)
if not exists(select * from G_UserList where G_UserName=@txtUserName)
begin
set @out=-1
end
else
begin
if not exists(select * from G_UserList where G_UserName=@txtUserName and G_UserPass=@txtUserPass)
begin
set @out=-2
end
else
begin
if exists(select * from G_UserList where G_UserName=@txtUserName and G_UserPass=@txtUserPass and G_Flag=@key)
begin
set @out=-3
end
else
select @out=G_id from G_UserList where G_UserName=@txtUserName and G_UserPass=@txtUserPass
end
end
--更新登录时间
update G_UserList set logintime = GETDATE() where G_UserName=@txtUserName
--更新登录次数
declare @loginCount int
set @loginCount=0
select @loginCount=loginCount from