我创建了一个 sql 过程来返回与用户名关联的密码。
SQL过程:
USE [C:\INETPUB\WWWROOT\ADDMARKER\MAP\MAP\APP_DATA\ASPNETDB.MDF]
GO
/****** Object: StoredProcedure [dbo].[aspnet_Membership_EmailPassword] Script Date: 10/18/2012 15:32:02 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[aspnet_Membership_EmailPassword]
-- Add the parameters for the stored procedure here
(
@UserName nvarchar(256),
@PasswordReturn nvarchar(128) out
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
DECLARE @UserId uniqueidentifier
DECLARE @Password nvarchar(128)
DECLARE @Return_Password nvarchar(256)
DECLARE @IsLockedOut bit
DECLARE @ErrorCode int
SET @ErrorCode = 0
DECLARE @TranStarted bit
SET @TranStarted = 0
SET NOCOUNT ON;
IF( @@TRANCOUNT = 0 )
BEGIN
BEGIN TRANSACTION
SET @TranStarted = 1
END
ELSE
SET @TranStarted = 0
SELECT @UserId = u.UserId,
@Password = m.Password,
@IsLockedOut = m.IsLockedOut
FROM dbo.aspnet_Users u, dbo.aspnet_Membership m WITH ( UPDLOCK )
WHERE u.UserId = m.UserId AND
LOWER(@UserName) = u.LoweredUserName
IF ( @@rowcount = 0 )
BEGIN
SET @ErrorCode = 1
END
IF( @IsLockedOut = 1 )
BEGIN
SET @ErrorCode = 99
END
IF(Not( @ErrorCode = 0) )
set @PasswordReturn = 'Error in search'
ELSE
set @PasswordReturn = @Password
RETURN @PasswordReturn
END
我收到错误
“消息 245,级别 16,状态 1,过程 aspnet_Membership_EmailPassword,第 59 行将 nvarchar 值 'egt1egt' 转换为数据类型 int 时转换失败。”
在执行该程序时。
请问有人可以帮忙吗?
谢谢