0
Error: java.sql.SQLSyntaxErrorException: 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 'dc, customerdata cd WHERE dc.location = '2' AND cd.username = 'jasmin" at line 1java.sql.SQLSyntaxErrorException:您的SQL語法有錯誤;
String dressLoc = dressno;
String nameRenter = jLabel1.getText();
String sql = "INSERT INTO orderdata (dressname,price,currentrenter,stat"
+ ",datereserve) SELECT dressname, price, concat(concat(fname,"
+ "' '), lname)AS currentrenter, 'Reserve', CURRENT_TIMESTAMP"
+ "FROM dresscatalog dc, customerdata cd WHERE dc.location = ? "
+ "AND cd.username = ?";
try
{
pst=conn.prepareStatement(sql);
pst.setString(1,dressLoc);
pst.setString(2,nameRenter);
pst.executeUpdate();
}
catch(SQLException ex)
{
JOptionPane.showMessageDialog(this, ex);
}
非常感謝你! –
@JasminApolinar歡迎您 – Jens