string strCmd= "select count(*) from user where (username like '"+textBox1.Text+"' and password='"+textBox2.Text +"')";
竟然用like?真的用户名: abcdef  1234
其实用:ab 1234 也可以登录

解决方案 »

  1.   

    strConn为空
    小弟看不出来什么问题
      

  2.   

    myCommand.Connection.Close();
                myConnection.Close();这两个写一个就可以了
      

  3.   

    string strCmd= "select count(*) from user where (username like '"+textBox1.Text+"' and password='"+textBox2.Text +"')";不应该用like 应该用=
      

  4.   

    int flag = (int)myCommand.ExecuteScalar();
    这个地方有问题吗?
      

  5.   

    错误是like后面加百分号,你没加啊,这样的登录也敢用啊
      

  6.   

    “竟然用like”,支持用Nike!!!