Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 19 su 19
  1. #11
    Utente di HTML.it L'avatar di paul78
    Registrato dal
    Apr 2010
    Messaggi
    515
    ragazzi io per la modifica scrivo questo:
    codice:
    String query = "UPDATE persone SET nome=?, cognome=? where id=?";           			        
    
    						
    
    ps = (PreparedStatement) conn.prepareStatement(query);       			        			        			       			
            			
    ps.setInt(1, updateID);					         			
    ps.setString(2, updateNome);
    ps.setString(3, updateCognome);					
    ps.executeUpdate();
    ma mi da sempre errore!!!

  2. #12
    Utente di HTML.it L'avatar di andbin
    Registrato dal
    Jan 2006
    residenza
    Italy
    Messaggi
    18,284
    Quote Originariamente inviata da paul78 Visualizza il messaggio
    codice:
    String query = "UPDATE persone SET nome=?, cognome=? where id=?";           			        
    
    ps.setInt(1, updateID);					         			
    ps.setString(2, updateNome);
    ps.setString(3, updateCognome);
    ma mi da sempre errore!!!
    Il primo ? è per il nome e tu gli passi il updateID (int).
    Il secondo ? è per il cognome e tu gli passi il nome.
    Il terzo ? è per il id di filtro e tu gli passi il cognome (String).

    Secondo te?
    Andrea, andbin.devSenior Java developerSCJP 5 (91%) • SCWCD 5 (94%)
    java.util.function Interfaces Cheat SheetJava Versions Cheat Sheet

  3. #13
    Utente di HTML.it L'avatar di paul78
    Registrato dal
    Apr 2010
    Messaggi
    515
    codice:
    String query = "UPDATE persone SET nome=?, cognome=? where id=?";           			        							
    ps = (PreparedStatement) conn.prepareStatement(query);       			        			        			       			
            			
    ps.setString(1, updateNome);
    ps.setString(2, updateCognome);
    ps.setInt(3, updateID);					         									
    										       			
    ps.executeUpdate();

    già fatto!!! ma mi da lo stesso errore!!!

  4. #14
    Utente di HTML.it L'avatar di andbin
    Registrato dal
    Jan 2006
    residenza
    Italy
    Messaggi
    18,284
    Quote Originariamente inviata da paul78 Visualizza il messaggio
    ma mi da lo stesso errore!!!
    Dando ora per scontato che almeno i parametri sono appropriati .... quale errore? Se hai una eccezione dicci quale.
    Andrea, andbin.devSenior Java developerSCJP 5 (91%) • SCWCD 5 (94%)
    java.util.function Interfaces Cheat SheetJava Versions Cheat Sheet

  5. #15
    Utente di HTML.it L'avatar di paul78
    Registrato dal
    Apr 2010
    Messaggi
    515
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception: Unknown column 'id' in 'where clause'
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:41 1)
    at com.mysql.jdbc.Util.getInstance(Util.java:386)
    at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:1052)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:3609)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:3541)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:20 02)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java :2163)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionIm pl.java:2624)
    at com.mysql.jdbc.PreparedStatement.executeInternal(P reparedStatement.java:2127)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(Pre paredStatement.java:2427)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(Pre paredStatement.java:2345)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(Pre paredStatement.java:2330)
    at EsempioJDBC$2.handle(EsempioJDBC.java:265)
    at EsempioJDBC$2.handle(EsempioJDBC.java:1)
    at com.sun.javafx.event.CompositeEventHandler.dispatc hBubblingEvent(Unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchB ubblingEvent(Unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchB ubblingEvent(Unknown Source)
    at com.sun.javafx.event.CompositeEventDispatcher.disp atchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatch Event(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispat chEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatch Event(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispat chEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatch Event(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispat chEvent(Unknown Source)
    at com.sun.javafx.event.EventUtil.fireEventImpl(Unkno wn Source)
    at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
    at javafx.event.Event.fireEvent(Unknown Source)
    at javafx.scene.Node.fireEvent(Unknown Source)
    at javafx.scene.control.Button.fire(Unknown Source)
    at com.sun.javafx.scene.control.behavior.ButtonBehavi or.mouseReleased(Unknown Source)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase $1.handle(Unknown Source)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase $1.handle(Unknown Source)
    at com.sun.javafx.event.CompositeEventHandler$NormalE ventHandlerRecord.handleBubblingEvent(Unknown Source)
    at com.sun.javafx.event.CompositeEventHandler.dispatc hBubblingEvent(Unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchB ubblingEvent(Unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchB ubblingEvent(Unknown Source)
    at com.sun.javafx.event.CompositeEventDispatcher.disp atchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatch Event(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispat chEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatch Event(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispat chEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatch Event(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispat chEvent(Unknown Source)
    at com.sun.javafx.event.EventUtil.fireEventImpl(Unkno wn Source)
    at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
    at javafx.event.Event.fireEvent(Unknown Source)
    at javafx.scene.Scene$MouseHandler.process(Unknown Source)
    at javafx.scene.Scene$MouseHandler.access$1800(Unknow n Source)
    at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Un known Source)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$Mo useEventNotification.run(Unknown Source)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$Mo useEventNotification.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.ha ndleMouseEvent(Unknown Source)
    at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
    at com.sun.glass.ui.View.notifyMouse(Unknown Source)
    at com.sun.glass.ui.win.WinApplication._runLoop(Nativ e Method)
    at com.sun.glass.ui.win.WinApplication.access$300(Unk nown Source)
    at com.sun.glass.ui.win.WinApplication$4$1.run(Unknow n Source)
    at java.lang.Thread.run(Unknown Source)

  6. #16
    Utente di HTML.it L'avatar di paul78
    Registrato dal
    Apr 2010
    Messaggi
    515
    EsempioJDBC.java:265

    SI TROVA ESATTEMENTE AL ps.
    executeUpdate();

  7. #17
    Utente di HTML.it L'avatar di andbin
    Registrato dal
    Jan 2006
    residenza
    Italy
    Messaggi
    18,284
    Quote Originariamente inviata da paul78 Visualizza il messaggio
    Unknown column 'id' in 'where clause'
    La tua tabella 'persone' ha la colonna "id"? Puoi mostrare come l'hai creata? (la tabella intendo, se da script SQL)
    Ultima modifica di andbin; 03-05-2014 a 19:24
    Andrea, andbin.devSenior Java developerSCJP 5 (91%) • SCWCD 5 (94%)
    java.util.function Interfaces Cheat SheetJava Versions Cheat Sheet

  8. #18
    Utente di HTML.it L'avatar di paul78
    Registrato dal
    Apr 2010
    Messaggi
    515
    l'ho creato con interfaccia grafica di mysql.

    cmq ora vado a controllare lo script in mysql

  9. #19
    Utente di HTML.it L'avatar di paul78
    Registrato dal
    Apr 2010
    Messaggi
    515
    ragazzi!!!

    l'id era "idpersone"

    eppure ero certo di aver scritto solo id!!!

    cmq grazie a te ho capito che devo anche rivedere lo script di mysql!

    grazie mille!!!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.