【SQL】找不到存储过程 ‘dbo.aspnet_Membership_GetUserByUserId’ 的解决办法

    C#用Membership功能时报了这么个错误

    找不到存储过程 'dbo.aspnet_Membership_GetUserByUserId'

    根据提示,很显然数据库里缺少响应的存储过程,用数据库管理器打开对应的数据库执行以下sql语句即可。



    SET QUOTED_IDENTIFIER OFF
    GO
    
    CREATE PROCEDURE dbo.aspnet_Membership_GetUserByUserId
        @UserId               uniqueidentifier,
        @CurrentTimeUtc       datetime,
        @UpdateLastActivity   bit = 0
    AS
    BEGIN
        IF ( @UpdateLastActivity = 1 )
        BEGIN
            UPDATE   dbo.aspnet_Users
            SET      LastActivityDate = @CurrentTimeUtc
            FROM     dbo.aspnet_Users
            WHERE    @UserId = UserId
    
            IF ( @@ROWCOUNT = 0 ) -- User ID not found
                RETURN -1
        END
    
        SELECT  m.Email, m.PasswordQuestion, m.Comment, m.IsApproved,
                m.CreateDate, m.LastLoginDate, u.LastActivityDate,
                m.LastPasswordChangedDate, u.UserName, m.IsLockedOut,
                m.LastLockoutDate
        FROM    dbo.aspnet_Users u, dbo.aspnet_Membership m
        WHERE   @UserId = u.UserId AND u.UserId = m.UserId
    
        IF ( @@ROWCOUNT = 0 ) -- User ID not found
           RETURN -1
    
        RETURN 0
    END
    
    GO

    参考:[dbo].[aspnet_Membership_GetUserByUserId]



    本博客所有文章如无特别注明均为原创。
    复制或转载请以超链接形式注明转自枫芸志,原文地址《【SQL】找不到存储过程 ‘dbo.aspnet_Membership_GetUserByUserId’ 的解决办法
    标签:
    分享:

还没有人抢沙发呢~

无觅相关文章插件,快速提升流量