-1
String query = "insert into dept values(?,'?','?'))";
PreparedStatement pu=con.prepareStatement(query);
pu.setInt(1, 2);
pu.setString(2, "a");
pu.setString(3, "ss");
pu.execute(query);
String query = "insert into dept values(?,'?','?'))";
PreparedStatement pu=con.prepareStatement(query);
pu.setInt(1, 2);
pu.setString(2, "a");
pu.setString(3, "ss");
pu.execute(query);
刪除問號周圍的引號。
單引號圍繞佔位符字符引起此錯誤。刪除它們:
String query = "insert into dept values(?,?,?))";
他們比不必要更糟糕:他們是問題的原因。 –
小心提問? –