private void InsertBuget() throws SQLException { ExtragereDate(); String insertOfBuget = "Insert into buget (denumire, valoare, data_inceput, data_sfarsit, detalii_buget)" + "value (?,?,?,?,?)"; ps = connected.prepareStatement(insertOfBuget); ps.setInt(1, VenitNou.getTip()); ps.setBigDecimal(2, VenitNou.getValoare()); ps.setString(3, VenitNou.getData_inceput()); ps.setString(4, VenitNou.getData_sfarsit()); ps.setString(5, VenitNou.getDetalii()); ps.executeUpdate(); }
private void ExtragereDate() { item = jcbxVenituri.getSelectedItem(); value = ((ItemsOfComboBox) item).getId(); VenitNou.setTip(value); BigDecimal venit = new BigDecimal(jtfVenit.getText()); VenitNou.setValoare(venit); Date data_inceput = jDataInceput.getDate(); SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd"); String date_inceput = format.format(data_inceput); VenitNou.setData_inceput(date_inceput); Date data_sfarsit = jDataSfarsit.getDate(); SimpleDateFormat formatSf = new SimpleDateFormat("yyyy/MM/dd"); String date_sfarsit = formatSf.format(data_sfarsit); VenitNou.setData_sfarsit(date_sfarsit); VenitNou.setDetalii(jtfDetaliiBuget.getText()); }