本帖最后由 jacyemc 于 2012-04-18 23:02:36 编辑

解决方案 »

  1.   

    username在数据库中是integer类型了。
      

  2.   

    查询表名加上[login] login是关键字 LZ表命名很不规范
      

  3.   

    数据库表中是不是定义为int型啦,检查下
      

  4.   

    数据库中类型是varchar没有问题 
    将Session["CurrentValue"] = lusername.Text;
    这一行删除
    就能使用字符用户名登陆成功
      

  5.   

    已经解决了 问题出在后面
    在比较时
    "select title,date from new where username='" + Session["CurrentValue"].ToString() + " '"
    写错为"select title,date from new where username='" + Session["CurrentValue"].ToString() 
    主要一直没看语法 嘿嘿
      

  6.   

    Session["CurrentValue"] = lusername.Text.tostring();
      

  7.   

    SqlCommand command = new SqlCommand("select * from login where username='" + lusername.Text+ " ' and password='" + lpassword.Text+ " '", conn);你的username应该只能传int类型的,但是你传了字符串类型的数据,所以报错,你在传值之前要转成INT类型