数据截断:截断了错误的DOUBLE值:“ Id”

时间:2019-05-03 20:14:34

标签: java mysql

数据截断:截断了错误的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");
    }

0 个答案:

没有答案