对了
string strCmd="select count(*) from user where (username like '"+TextBox1.Text"' and pwd like '"+TextBox2.Text+"')";应该是用like 还是==啊?? 

解决方案 »

  1.   

    string strCmd="select count(*) from [user] where (username like '"+TextBox1.Text"' and pwd like '"+TextBox2.Text+"')";
    加上[]
      

  2.   

    sjc0(流浪者) string strCmd="select count(*) from user where (username like '"+TextBox1.Text"' and pwd like '"+TextBox2.Text+"')";应该是用like 还是=啊
      

  3.   

    应该是用like 还是==啊?? 
    都可以吧
      

  4.   

    忘了说
    ='"+TextBox1.Text"' and pwd = '"+TextBox2.Text+"')";
    完整的string strCmd="select count(*) from [user] where username = '"+TextBox1.Text"' and pwd = '"+TextBox2.Text+"'";
      

  5.   

    同意sjc0(流浪者) 的!应该是你的数据表的名字和数据库中的关键字冲突了,加上[]可以避免这种冲突,你的SQL语句看上去没有错误!
      

  6.   

    没有通配符的情况下=和like效果应该是一样的!所以只需要添加一个[]就应该可以了!