数据截断:截断了错误的DOUBLE值:“ Id”
我有上面错误的代码。请帮我一个建议。谢谢。
DefaultTableModel model = (DefaultTableModel) table_app.getModel();
int x = JOptionPane.showConfirmDialog(null, "Are you sure you want to
UPDATE Appointment?", "UPDATE Appointment",JOptionPane.YES_NO_OPTION);
int row = table_app.getSelectedRow();
String cell = table_app.getModel().getValueAt(row, 0).toString();
if(x >= 0){
try{
String firstname = txt_firstname.getText();
String name = txt_surname.getText();
String fee = txt_fee.getText();
String time = (String)cbox_time.getSelectedItem();
String date = txt_date.getText();
String doctor = (String)cbox_doctors.getSelectedItem();
String sql = "UPDATE `appointments` SET `Patient_First_Name`='"+firstname+"',`Patient_Surname`='"+name+"',`Fees`='"+fee+"',`Time`='"+time+"',`Date`='"+date+"',`Doctor`='"+doctor+"' WHERE 'Id' = " + cell;
pst = conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(null, "Appointment Updated");
Update_table();
}catch (Exception e){
System.out.println(e.getMessage());
// JOptionPane.showMessageDialog(null, "ERROR");
}
} else {
JOptionPane.showMessageDialog(null, "ERROR");
}