Пример #1
0
  public ArrayList<VentasBean> obtenerMensajes() {
    Connection cn = null;
    ArrayList<VentasBean> mensaje = null;
    Statement st;
    ResultSet rs;
    try {
      cn = getConnection();
      st = cn.createStatement();
      String tsql;
      tsql = "select * from ventas";
      rs = st.executeQuery(tsql);
      mensaje = new ArrayList<VentasBean>();
      while (rs.next()) {
        VentasBean m =
            new VentasBean(
                rs.getInt("id_venta"),
                rs.getInt("id_linea"),
                rs.getString("fecha_venta"),
                rs.getString("descripcion"));
        mensaje.add(m);
      }
      cn.close();

    } catch (Exception e) {
      e.printStackTrace();
    }
    return (mensaje);
  }
Пример #2
0
 public void eliminarVenta(String id) {
   Connection cn;
   Statement st;
   ResultSet rs;
   try {
     cn = getConnection();
     st = cn.createStatement();
     String tsql;
     tsql = "delete from ventas where id_venta='" + id + "'";
     st.execute(tsql);
     cn.close();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Пример #3
0
 public void guardarVenta(VentasBean m) {
   Connection cn;
   Statement st;
   ResultSet rs;
   try {
     cn = getConnection();
     st = cn.createStatement();
     String tsql;
     tsql = "Insert into ventas (id_linea,fecha_venta,descripcion) values('";
     tsql += m.getId_linea() + "','" + m.getFecha() + "','" + m.getDescripcion() + "')";
     st.execute(tsql);
     cn.close();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }