1
String Sql = " INSERT INTO asset_update
        (asset_id,
         date_acquired,
         item_code,
         serial_number,
         cost_of_acquisition,
         estimated_useful_life,
         estimated_residual_value,
         depreciation_start_date,
         USER,
         status,
         disposal_date,
         asset_image)
     VALUES  (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)  ";
        pst = conn.prepareStatement(Sql);
        pst.setString(1, assetid.getText());
        pst.setString(2, ((JTextField) date_aquired.getDateEditor().getUiComponent()).getText());

        String itemCode = ComboBox_itemCode.getSelectedItem().toString();
        pst.setString(3, itemCode);
        pst.setString(4, txt_sn.getText());


        pst.setString(5, txt_coa.getText());
        pst.setString(6, eul.getText());
        pst.setString(7, txt_erv.getText());
        pst.setString(8, ((JTextField) date_dsd.getDateEditor().getUiComponent()).getText());

        String user = jComboBox_Users.getSelectedItem().toString();
        pst.setString(9, user);
        String status = ComboBox_status.getSelectedItem().toString();
        pst.setString(10, status);
        pst.setString(11, ((JTextField) date_dd.getDateEditor().getUiComponent()).getText());           
        pst.setBytes(12,persons_image);

这是我的代码,但是如果我想在我的插入语句中添加另一个具有不同列的表怎么办

4

0 回答 0