日期:2014-05-18 浏览次数:20633 次
CREATE proc CheckLogin @UserName varchar(20) ,@UserPassword varchar(40), @Msg varchar(100) output, @ResultID bit output as begin declare @ResultCount int /*返回行数*/ declare @StoredPassWord varchar(40) /*传递查询得到的密码*/ select @ResultCount = count(*) from S_UserInfo where UName = @UserName if @ResultCount = 0 begin set @Msg = '用户名不存在,请重新输入!' set @ResultID = 0 end else begin select @StoredPassWord = UPassword from S_UserInfo where UName = @UserName if @StoredPassWord = @UserPassword begin set @Msg = '登录成功!' set @ResultID = 1 end else begin set @Msg = '密码或用户名错误' set @ResultID = 0 end end end
declare @m varchar(50),@r bit execute CheckLogin 'aaa','111', @m output,@r output select @m ,@r
exec sp_help 'S_UserInfo'
------解决方案--------------------
--先确定表S_UserInfo是否存在 --如果存在写成 --库名.所有着.UserInfo 看看你的所有者是什么~~
------解决方案--------------------
CREATE proc CheckLogin @UserName varchar(20) ,@UserPassword varchar(40), @Msg varchar(100) output, @ResultID bit output as begin declare @ResultCount int /*返回行数*/ declare @StoredPassWord varchar(40) /*传递查询得到的密码*/ select @ResultCount = count(*) from 表所有者.S_UserInfo where UName = @UserName if @ResultCount = 0 begin set @Msg = '用户名不存在,请重新输入!' set @ResultID = 0 end else begin select @StoredPassWord = UPassword from 表所有者.S_UserInfo where UName = @UserName if @StoredPassWord = @UserPassword begin set @Msg = '登录成功!' set @ResultID = 1 end else begin set @Msg = '密码或用户名错误' set @ResultID = 0 end end end
------解决方案--------------------
你应该是要去修改表所有者为dbo
------解决方案--------------------