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