Results 1 to 2 of 2
  1. #1
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default What's wrong with my code?

    I can't figure out what's wrong with my code. It runs and everything, but it doesn't put in any values into the database.
    Java Code:
     private String naam1;
          private String naam2;
          private String playup;
          private String rotate;
       
           SQLUserinfo (String nm1, String nm2, String plyp, String rtte)throws SQLException
          {
             naam1 = nm1;
             naam2 = nm2;
             playup = plyp;
             rotate = rtte;
             updateMthd("INSERT INTO Extra VALUES(naam1, naam2, playup, rotate)");     
          }
    here is the errors:
    Java Code:
    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 4.
    	at Userinfo.button1MouseClicked(Userinfo.java:40)
    	at Userinfo.access$100(Userinfo.java:12)
    	at Userinfo$2.mouseClicked(Userinfo.java:204)
    	at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
    	at java.awt.Component.processMouseEvent(Component.java:6041)
    	at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    	at java.awt.Component.processEvent(Component.java:5803)
    	at java.awt.Container.processEvent(Container.java:2058)
    	at java.awt.Component.dispatchEventImpl(Component.java:4410)
    	at java.awt.Container.dispatchEventImpl(Container.java:2116)
    	at java.awt.Component.dispatchEvent(Component.java:4240)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
    	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3995)
    	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
    	at java.awt.Container.dispatchEventImpl(Container.java:2102)
    	at java.awt.Window.dispatchEventImpl(Window.java:2429)
    	at java.awt.Component.dispatchEvent(Component.java:4240)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
    Caused by: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 4.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957)
    	at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114)
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110)
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338)
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288)
    	at SQLUserinfo.updateMthd(SQLUserinfo.java:75)
    	at SQLUserinfo.<init>(SQLUserinfo.java:24)
    	at Userinfo.button1MouseClicked(Userinfo.java:34)
    	... 23 more
    Last edited by Johanis; 10-30-2011 at 11:33 AM.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,525
    Blog Entries
    7
    Rep Power
    20

    Default Re: What's wrong with my code?

    You still have another tread running about the very same subject: SQL problems. I'm locking this one.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. What is wrong with this code?
    By Mythreadings in forum New To Java
    Replies: 38
    Last Post: 11-19-2010, 12:43 AM
  2. Need help! something wrong in my code
    By novak100 in forum New To Java
    Replies: 2
    Last Post: 11-18-2009, 11:59 PM
  3. what's the wrong in this Code
    By the swan in forum AWT / Swing
    Replies: 1
    Last Post: 04-04-2009, 04:27 AM
  4. pls tell wat wrong with my code???
    By low224 in forum New To Java
    Replies: 13
    Last Post: 01-11-2009, 07:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •