How to insert into two or more different tables in MySQL using Java -
string sql = " insert 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);
this code if want add table different columns insert statement
Comments
Post a Comment