本文介绍了不允许现有用户使用存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 亲爱的, 使用存储过程不允许现有用户 我正在编写代码下面工作正常,但用户名正常工作,电子邮件无法正常工作我想要两个都不允许现有的电子邮件和用户名 这里有什么错误请回复我 ALTER PROCEDURE [dbo]。[sp_userinformation] @ UserName varchar ( 50 ) , @密码 varchar ( 50 ), @ FirstName varchar ( 50 ), @ LastName varchar ( 50 ), @ Email varchar ( 50 ), @ PhoneNo varchar ( 50 ), @ Location varchar ( 50 ), @ Created_By varchar ( 50 ), @ ERROR VARCHAR ( 100 )OUT AS BEGIN - 添加SET NOCOUNT ON以防止来自 $的额外结果集b $ b - 干扰SELECT语句。 SET NOCOUNT ON ; - - 如果用户不存在则检查条件是否存在如果用户不存在则返回不同的消息exists返回不同的消息 IF NOT EXISTS ( SELECT * FROM User_Information WHERE UserName = @ UserName AND 电子邮件= @电子邮件) BEGIN INSERT INTO User_Information (用户名, [密码], FirstName,姓氏,电子邮件, PhoneNo,位置, Created_By ) VALUES ( @ UserName , @ Password , @ FirstName , @ LastName , @ Email , @ PhoneNo , @ Location , @ Created_By ) - 如果用户成功注册我正在将此消息作为输出参数退出 SET @ ERROR = @ UserName + ' 已成功注册' END ELSE BEGIN - 如果用户已存在我将此消息作为输出参数返回 SET @ ERROR = @ UserName + ' 已存在' SET @ ERROR = @Email + ' 已存在' END 结束 这里有什么错误回复我解决方案 Dear all,using stored procedure does not allow the existing useram writing code below is working properly but username working properly and email not working i want both does not allow the existing email and usernamewhat mistake here please reply meALTER PROCEDURE [dbo].[sp_userinformation]@UserName varchar(50),@Password varchar(50),@FirstName varchar(50),@LastName varchar(50),@Email varchar(50),@PhoneNo varchar(50),@Location varchar(50),@Created_By varchar(50),@ERROR VARCHAR(100) OUTASBEGIN-- SET NOCOUNT ON added to prevent extra result sets from-- interfering with SELECT statements.SET NOCOUNT ON;---Checking Condition if User exists or not if user not exists returns different message if exists returns different messageIF NOT EXISTS(SELECT * FROM User_Information WHERE UserName=@UserName AND Email=@Email)BEGININSERT INTO User_Information(UserName,[Password],FirstName,LastName,Email,PhoneNo,Location,Created_By)VALUES(@UserName,@Password,@FirstName,@LastName,@Email,@PhoneNo,@Location,@Created_By)--If User Successfully Registerd I am returing this Message as Output ParameterSET @ERROR=@UserName+' Registered Successfully'ENDELSEBEGIN--If User already Exists i am returning this Message as Output ParameterSET @ERROR=@UserName + ' Already Exists'SET @ERROR=@Email + 'Already Exists'ENDENDhere what mistake plese reply me 解决方案 这篇关于不允许现有用户使用存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的..
09-06 09:16