forked from Miler13/sisII
-
Notifications
You must be signed in to change notification settings - Fork 0
/
detalleVenta
28 lines (24 loc) · 995 Bytes
/
detalleVenta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public DefaultTableModel obtenerVentas (){
DefaultTableModel modelo = new DefaultTableModel();
modelo.addColumn("ID/ ventas");
modelo.addColumn("Comprador");
modelo.addColumn("Modelo de Auto");
modelo.addColumn("Tipo de venta");
String sql = "SELECT * FROM DetalleVenta";
String datos[] = new String [4];
Statement st;
try{
st = cn.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
datos[0] = rs.getString(1);
datos[1] = rs.getString(2);
datos[2] = rs.getString(3);
datos[3] = rs.getString(4);
modelo.addRow(datos);
}
} catch (SQLException ex) {
Logger.getLogger(InterfazVistas.class.getName()).log(Level.SEVERE, null, ex);
}
return modelo;
}