
展开全部
使用存储过程就可以!
CREATE PROCEDURE [dbo].[d_hotelsLogin]
@ID decimal =0 output,
@userID varchar(50),
@pwd varchar(50),
@log_ip varchar(50)
AS
begin
if not exists(select * from dbo.[hotels] where userID=@userID and pwd=@pwd)
begin
return 0
end
else
begin
select @ID = id from dbo.[hotels] where userID=@userID and pwd=@pwd
update dbo.[hotels] set log_time=getDate(),log_count=log_count+1,log_ip=@log_ip where id=@ID and dateDiff(d,log_time,getDate())<>0
return 1
end
end
GO
CREATE PROCEDURE [dbo].[d_hotelsLogin]
@ID decimal =0 output,
@userID varchar(50),
@pwd varchar(50),
@log_ip varchar(50)
AS
begin
if not exists(select * from dbo.[hotels] where userID=@userID and pwd=@pwd)
begin
return 0
end
else
begin
select @ID = id from dbo.[hotels] where userID=@userID and pwd=@pwd
update dbo.[hotels] set log_time=getDate(),log_count=log_count+1,log_ip=@log_ip where id=@ID and dateDiff(d,log_time,getDate())<>0
return 1
end
end
GO
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这有什么问题么 ..?
一般的 SQL 查询不都是用一条 SELECT 语句之后把结果赋给 RecordSet ...?
一般的 SQL 查询不都是用一条 SELECT 语句之后把结果赋给 RecordSet ...?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询