异常为 your MySQL server version for the right syntax to use near 'id ='2256'' at line 1"求救!急
java.sql.SQLException:Syntaxerrororaccessviolationmessagefromserver:"Youhaveanerrorin...
java.sql.SQLException: Syntax error or access violation message from server: "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 'id ='2256'' at line 1"
我的语句是if (a.getBalance() >= p.getPrice()) {
double i = a.getBalance() - p.getPrice();
sql = "update customer set balance=" + i + " where username ='"
+ a.getUsername() + "'";
stat.executeUpdate(sql);
if (i > 0) {
int c = p.getInventory();
c--;
String sq = "update Virsualproduct set inventory =" + c + "where id ='"+ p.getVID() + "'";
stat.executeUpdate(sq);显示这一句错误,可是不知道为什么错了
for (int j = 0; j < cc.size(); j++) {
if (p.getName().equals(cc.get(j).getName())) {
int t = cc.get(j).getInventory();
t++;
sql = "update BuyProduct set inventory=" + t
+ " where name ='" + cc.get(j).getName() + "'";
stat.executeUpdate(sql);
q++;
cc.remove(cc.get(j));
}
}
已经知道错误,谢谢~~ 展开
我的语句是if (a.getBalance() >= p.getPrice()) {
double i = a.getBalance() - p.getPrice();
sql = "update customer set balance=" + i + " where username ='"
+ a.getUsername() + "'";
stat.executeUpdate(sql);
if (i > 0) {
int c = p.getInventory();
c--;
String sq = "update Virsualproduct set inventory =" + c + "where id ='"+ p.getVID() + "'";
stat.executeUpdate(sq);显示这一句错误,可是不知道为什么错了
for (int j = 0; j < cc.size(); j++) {
if (p.getName().equals(cc.get(j).getName())) {
int t = cc.get(j).getInventory();
t++;
sql = "update BuyProduct set inventory=" + t
+ " where name ='" + cc.get(j).getName() + "'";
stat.executeUpdate(sql);
q++;
cc.remove(cc.get(j));
}
}
已经知道错误,谢谢~~ 展开
1个回答
2016-06-28
展开全部
order后面加空格:insertintoorder(order_id,user_id)values('1','1');
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询