我想的是把表中的一个字段取出来放到字符串数组里,然后用TextBox.Text去跟数组中的每一项去比较,正确的话走一步,否则提示错误/
问题就是我不知道怎么把某一列付给数组,麻烦告诉我

解决方案 »

  1.   

    要么你用用户输入的用户名去数据库查询,例如:
    string strQuery="select password from yourtable where username='"+
         txtUserName.Text+"'";
    或直接
    string strQuery="select * from yourtable where username='"+
         txtUserName.Text+"' and "
         +"password='"+txtPassword.Text+"'";
    用它进行查询,看是否能查到记录,从而判断用户是否合法。