jsp中的SQl语句有问题
SQL语句如下:Stringcondition="SELECT*FROMuserWHEREusername="+name+"and"+"password="+passwo...
SQL语句如下:
String condition = "SELECT * FROM user WHERE username="+name+"and"+"password="+password;
运行时出的错:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
请问应该怎样写 展开
String condition = "SELECT * FROM user WHERE username="+name+"and"+"password="+password;
运行时出的错:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
请问应该怎样写 展开
2个回答
展开全部
String condition = " select * from user where username = "+name+" and password = "+password;
空格加好,,java不会帮你加空格的.你在数据库运行一段没有空格的语句能不出错么..
空格加好,,java不会帮你加空格的.你在数据库运行一段没有空格的语句能不出错么..
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询