示例#1
0
  public void seraDegistir(Sera sera) {
    try {
      baglan();
      PreparedStatement guncelle =
          baglanti.prepareStatement(
              "update sera set"
                  + " port=?, IP=?, sera_adres=?,urun_cinsi=?,sera_sicaklik=?,sera_nem=? where sera_Ad=?");
      guncelle.setInt(1, sera.getPort());
      guncelle.setString(2, sera.getIP());

      guncelle.setString(3, sera.getSera_adres());
      guncelle.setString(4, sera.getUrun_cinsi());
      guncelle.setInt(5, sera.getSicaklik());
      guncelle.setInt(6, sera.getNem());
      guncelle.setString(7, sera.getSera_adi());
      guncelle.executeUpdate();
      guncelle.close();
    } catch (Exception e) {
      mesaj = e.getMessage();
      System.out.println(e.getMessage());
    } finally {
      baglantiKes();
    }
  }
示例#2
0
  public void seraKaydet(Sera sera) throws SQLException {
    baglan();
    try {

      PreparedStatement kaydet =
          baglanti.prepareStatement("insert into sera values" + "(?,?,?,?,?,?,?)");
      kaydet.setString(3, sera.getSera_adi());
      kaydet.setString(4, sera.getSera_adres());
      kaydet.setString(2, sera.getIP());
      kaydet.setInt(1, sera.getPort());
      kaydet.setString(5, sera.getUrun_cinsi());
      kaydet.setInt(6, sera.getSicaklik());
      kaydet.setInt(7, sera.getNem());
      kaydet.executeUpdate();
      kaydet.close();

    } catch (Exception e) {
      mesaj = e.getMessage();
      System.out.println(mesaj);

    } finally {
      baglantiKes();
    }
  }