当前位置: 代码迷 >> .NET面试 >> 又遇到列名无效了!该怎么处理
  详细解决方案

又遇到列名无效了!该怎么处理

热度:51   发布时间:2016-05-02 20:51:23.0
又遇到列名无效了!!!
列名 'isLock' 无效。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.Data.SqlClient.SqlException: 列名 'isLock' 无效。

堆栈跟踪: 


[SqlException (0x80131904): 列名 'isLock' 无效。]
  System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890
  System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875
  System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
  System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
  System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
  System.Data.SqlClient.SqlDataReader.get_MetaData() +83
  System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
  System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
  System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
  System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
  System.Data.SqlClient.SqlCommand.ExecuteScalar() +139

源代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WgCms.BLL;
using WgCms.Model;

public partial class Admin_Login : System.Web.UI.Page
{
  WgCms.BLL.Admin bll = new WgCms.BLL.Admin();
  protected void Page_Load(object sender, EventArgs e)
  {

  }
  protected void loginsubmit_Click(object sender, ImageClickEventArgs e)
  {
  string UserName = txtUserName.Text.Trim();
  string UserPwd = txtUserPwd.Text.Trim();
   
  string validateCode = string.Empty;
  if (Session["ValidateCode"] == null)
  {
  lbMsg.Text = "你在登陆页面停留的时间过长,验证码已失效!";
  }
  else
  {
  validateCode = Session["ValidateCode"].ToString();
  }
  if (UserName.Equals("") || UserPwd.Equals(""))
  {
  lbMsg.Text = "请输入您要登录用户名或密码";
  }
  else
  {
  #region 记录登录次数
  if (Session["AdminLoginSun"] == null)
  {
  Session["AdminLoginSun"] = 1;
  }
  else
  {
  Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1;
  }
  #endregion

  //判断登录  
   
   
  if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 3)
  {
  lbMsg.Text = "登录错误超过3次,请关闭浏览器重新登录。";
  Session["AdminLoginSun"] = 1;
  }

   
  相关解决方案