是sql语句输入的错误

错误语句为 cmd.CommandText = "select count(*) from student where stuid = "+stuid+" and stupassword = "+stupassword+"";

虽然这样的语句运行不会出错,但是当你在输入框输入的是字母时,提交时会提示sql语句发生错误

修改方法为

将每个传入的变量再分别加一个单引号即可

例如

 cmd.CommandText = "select count(*) from student where stuid = '"+stuid+"' and stupassword = '"+stupassword+"'";

这样即可