public void updateSlaParam(SlaParam slaParam) { try { PreparedStatement preparedStatement = connection.prepareStatement( "update casvid_slaparameters set slaparam_name=?, slaparam_unit=?, slaparam_description=?" + "where slaparam_id=?"); // Parameters start with 1 preparedStatement.setString(1, slaParam.getSlaParamName()); preparedStatement.setString(2, slaParam.getSlaParamUnit()); preparedStatement.setString(3, slaParam.getSlaParamDesc()); preparedStatement.setInt(4, slaParam.getSlaParamId()); preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } }
public void addSlaParam(SlaParam slaParam) { try { PreparedStatement preparedStatement = connection.prepareStatement( "insert into casvid_slaparameters(slaparam_name,slaparam_unit,slaparam_description) values (?, ?, ?)"); preparedStatement.setString(1, slaParam.getSlaParamName()); preparedStatement.setString(2, slaParam.getSlaParamUnit()); preparedStatement.setString(3, slaParam.getSlaParamDesc()); preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } }