✀=✀ 附近有语法错误

2025-12-17 20:34:27
推荐回答(4个)
回答1:

mysqlcommand.CommandText = "select * from student where AccountNumber=" + student + "";
改为:
mysqlcommand.CommandText = "select * from student where AccountNumber=" + student ;

你这是SQL语句拼接错误。如果strdent是String类型的话还要用单引号引起来:
mysqlcommand.CommandText = "select * from student where AccountNumber=" + "'"+student+"'" ;

回答2:

AccountNumber是不是数字型的话,要用单引号引起来,

mysqlcommand.CommandText = "select * from student where AccountNumber='" + student + "'";

回答3:

mysqlcommand.CommandText ='"select * from student where AccountNumber='" + student + "'";
如果还错误的话把输入法换成英文的,再把所有的=重打一次。

回答4:

应该是你的查询语句错了,"select * from student where AccountNumber=" + student + "";那个student是个啥子控键?加.text属性试试。