我正在开发一个 n 层 java 应用程序,在实现插入方法时,我收到此错误:(conn=146) 列计数与第 1 行的值计数不匹配我正在使用 mariadb 数据库和 logic-DAO-View 模型这是代码:道: try { Statement st = conex.getConnection().createStatement(); st.executeQuery("INSERT INTO abas001 (abas_cod, abas_cnt, abas_vol, abas_und) VALUES ('" + miAbasto.getAbas_cod() + "', '" + miAbasto.getAbas_cnt() + "', '" + miAbasto.getAbas_vol() + "', '" + miAbasto.getAbas_und() + "', '" + "')"); } catch (SQLException e) { System.out.println(e.getMessage()); JOptionPane.showMessageDialog(null, "No se Registró, verifique la consola para ver el error", "Error", JOptionPane.ERROR_MESSAGE); } } //和视图代码: botonGuardar.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ pabascnt = Integer.parseInt(txtcant.getText()); pabasvol = Double.parseDouble(txtvol.getText()); AbastosDao abdao = new AbastosDao(); AbastosLog parabl = new AbastosLog(); parabl.setAbas_cod(pabascod); parabl.setAbas_cnt(pabascnt); parabl.setAbas_vol(pabasvol); parabl.setAbas_und(pabasund); abdao.registrarAbasto(parabl); mostrarDatosConTableModel(); } }); }错误在哪里?我认为错误是向 DAO 发送参数,但我不知道。
添加回答
举报
0/150
提交
取消