2016-12-06 29 views
-1

我正在尋找這個問題的解決方案,但我找不到它。我什麼都試過,他們在論壇上說,但沒有對我的作品操作數應該包含1列插入

public boolean ingresarEntrada(String pl, String fech, String hora,String tipo){ 

    ConexionBD sql=new ConexionBD(); 
    Connection cn = sql.Conectar(); 



    String query= "insert into datos(serie, placa, fecha, hora_entrada, hora_salida, tipo, transcurrido, total)" 
      + "values((NULL, '"+pl+"', '"+fech+"', '"+hora+"', '', '"+tipo+"', '', ''))"; 


    String mensaje="Datos ingresados correctamente"; 
    try { 


     sql.stmt.executeUpdate(query); 


    } catch (SQLException ex) { 
     JOptionPane.showMessageDialog(null,ex); 
     return false; 
    } 
    return true; 
} 
+0

日誌會在這裏超級有幫助 – UDKOX

+1

'total'後缺少空格' – Berger

+1

此外,大的建議,使用SQL查詢中的'PreparedStatement'。 – UDKOX

回答

0

有價值觀的內一組額外的括號。試試:

values(NULL, '"+pl+"', ... 

改爲。

+0

jejeps,這是,謝謝兄弟 –

相關問題