Statement s_add_purchase_wedding= conn.createStatement();
String sql_add_purchase_wedding = "INSERT INTO bidservice(token_id,added_id,purchase_id,service_type,type_id,bid_amount,forward_status,confirmation)VALUES"
+ "('"+url_id+"','"+added_id+"','"+purchase_id+"','"+pur_wed.getTypeWedding()+"',1,'"+pur_wed.getAmount()+"','"+pur_wed.getForwardAdmin()+"'"
+ ",'"+pur_wed.getConfirmation()+"')";
s_add_purchase_wedding.executeUpdate(sql_add_purchase_wedding);
我已经宣布了url_id
,added_id
和`puchase_id并为它们分配值。
您的错误在于将Integer(1)插入表中(+“',1,'”)。插入Integer的最佳方法是(“',”+ 1 +“,”)。
你这样做的时候怎么样?
String sql_add_purchase_wedding = "INSERT INTO bidservice(token_id, added_id, purchase_id, service_type, type_id, bid_amount, forward_status, confirmation) VALUES ("+
"'"+ url_id+"',"+
"'"+ added_id+"',"+
"'"+ purchase_id+"',"+
"'"+ pur_wed.getTypeWedding() +"',"+
1 +","+
"'"+ pur_wed.getAmount()+"',"+
"'"+ pur_wed.getForwardAdmin()+"',"+
"'"+ pur_wed.getConfirmation()+"'"+
")";
s_add_purchase_wedding.executeUpdate(sql_add_purchase_wedding);