0
Jtable'dan her satır için bir veritabanına eklemek istiyorum. Örneğin. İlk ürünü masaya ekler ama her birini eklemesini istiyorum.JTable'da her satır için veri tabanına ekle
private void addToInvoiceLine(){
try {
String sql = "Insert Into invoiceLine (invoiceID,SKU,quantity) values (?,?,?)";
pst = conn.prepareStatement(sql);
int row = resultsTable.getSelectedRow();
String sku = (orderTable.getModel().getValueAt(row, 0).toString());
String quantity = (orderTable.getModel().getValueAt(row, 2).toString());
pst.setString(1, invoiceNo.getText());
pst.setString(2, sku);
pst.setString(3, quantity);
pst.execute();
} catch (SQLException | HeadlessException e) {
JOptionPane.showMessageDialog(null, e);
} finally {
try {
rs.close();
pst.close();
} catch (Exception e) {
}
}
}
Eğer veritabanı tablosuna 'Jtable' tüm satırları kopyalamak istiyor musunuz? –
Evet, jTable – ZeeSoft
ürününe hiç bir ürün eklenmemiş. Ve bir döngü kullanırken neyin yanlış olduğu? (int satır = 0; satır
AJNeufeld