【问题标题】:An exception of type 'System.Data.SqlClient.SqlException' occurred发生“System.Data.SqlClient.SqlException”类型的异常
【发布时间】:2017-03-14 13:38:52
【问题描述】:

System.Data.dll 中出现“System.Data.SqlClient.SqlException”类型的异常,但未在用户代码中处理

附加信息:列名“PasswordFailuresSinceLastSuccess”无效。

        if (ModelState.IsValid)
        {
            // Attempt to register the user
            try
            {
                WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
                WebSecurity.Login(model.UserName, model.Password);
                return RedirectToAction("Index", "Home");
            }
            catch (MembershipCreateUserException e)
            {
                ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
            }
        }

【问题讨论】:

    标签: c# asp.net asp.net-mvc asp.net-mvc-4


    【解决方案1】:

    错误告诉您数据库表中没有PasswordFailuresSinceLastSuccess 这样的列。

    也许你有一个拼写错误。

    【讨论】:

    • 这是我的第一个大学项目,我使用 VisualStudio 搜索了包含“PasswordFailuresSinceLastSuccess”的任何内容,但没有成功。有什么建议吗?
    • 你搜索过整个解决方案吗?该错误表明您有一条 SQL 语句,其中某处包含“PasswordFailuresSinceLastSuccess”。
    • 是的,我使用了搜索整个解决方案的快捷方式,但仍然没有找到任何包含“PasswordFailuresSinceLastSuccess”的代码
    • 这才是问题所在。请查找您的 SQL 语句,并在您各自的 SELECT 语句中包含“PasswordFailuresSinceLastSuccess”列。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-01
    相关资源
    最近更新 更多