Answers for "Prepared Statement object in JDBC used to execute …………………. Queries."

4

jdbc prepared statement example

String query = "INSERT INTO artikel VALUES (?, ?, ?, ?, ?)";
try {
  PreparedStatement ps = con.prepareStatement(query);
  ps.setInt(1, aNumb);
  ps.setString(2, aName);
  ps.setFloat(3, aPrice);
  ps.setInt(4, aAvailable);
  ps.setString(5, aInfo);
  ps.executeUpdate();

  ps.close();
  disconnectDB();
}catch(SQLException e){
  System.out.println(e.getMessage());
}
Posted by: Guest on October-16-2020

Code answers related to "Prepared Statement object in JDBC used to execute …………………. Queries."

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language