日期:2014-05-18  浏览次数:20794 次

求帮忙的 在线等 用户代码未处理Exception
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class WebUserControl : System.Web.UI.UserControl
{
  protected void Page_Load(object sender, EventArgs e)
  {
  if (Session["uid"] != null)
  {
  div1.Visible = false;
  div2.Visible = true;
  Label1.Text = Session["uid"].ToString();
  }
  else
  {
  div1.Visible = true;
  div2.Visible = false;
  }
  }

  protected void Button1_Click(object sender, EventArgs e)
  {
  if (DbHelperSQL.GetSingle("select count(*) from sick where id ='" + TextBox1.Text + "' and password = '"+TextBox2.Text +"'").ToString() == "1") 这句代码 提示的这个问题 用户代码未处理exception 求解答 在线等 谢谢了 我是新手
  {
  Session["uid"] = TextBox1.Text;
  div1.Visible = false;
  div2.Visible = true;
  Label1.Text = Session["uid"].ToString();
  }
  else
  {
  Response.Write("<script>alert('账号或密码错误!');</script>");
  }
  }


  protected void LinkButton1_Click(object sender, EventArgs e)
  {
  Session.Clear();
  div1.Visible = true;
  div2.Visible = false;
  }
}

------解决方案--------------------
你调试下 到DbHelperSQL.GetSingle这个方法里的时候,f11进去,找到sql语句,取出来到数据库运行下看看有没有错