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

    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(
    	at Userinfo.access$100(
    	at Userinfo$2.mouseClicked(
    	at java.awt.AWTEventMulticaster.mouseClicked(
    	at java.awt.Component.processMouseEvent(
    	at javax.swing.JComponent.processMouseEvent(
    	at java.awt.Component.processEvent(
    	at java.awt.Container.processEvent(
    	at java.awt.Component.dispatchEventImpl(
    	at java.awt.Container.dispatchEventImpl(
    	at java.awt.Component.dispatchEvent(
    	at java.awt.LightweightDispatcher.retargetMouseEvent(
    	at java.awt.LightweightDispatcher.processMouseEvent(
    	at java.awt.LightweightDispatcher.dispatchEvent(
    	at java.awt.Container.dispatchEventImpl(
    	at java.awt.Window.dispatchEventImpl(
    	at java.awt.Component.dispatchEvent(
    	at java.awt.EventQueue.dispatchEvent(
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(
    	at java.awt.EventDispatchThread.pumpEventsForFilter(
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(
    	at java.awt.EventDispatchThread.pumpEvents(
    	at java.awt.EventDispatchThread.pumpEvents(
    Caused by: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 4.
    	at sun.jdbc.odbc.JdbcOdbc.createSQLException(
    	at sun.jdbc.odbc.JdbcOdbc.standardError(
    	at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(
    	at sun.jdbc.odbc.JdbcOdbcStatement.execute(
    	at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(
    	at SQLUserinfo.updateMthd(
    	at SQLUserinfo.<init>(
    	at Userinfo.button1MouseClicked(
    	... 23 more
    Last edited by Johanis; 10-30-2011 at 12:33 PM.

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: What's wrong with my code?

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

    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. What is wrong with this code?
    By Mythreadings in forum New To Java
    Replies: 38
    Last Post: 11-19-2010, 01:43 AM
  2. Need help! something wrong in my code
    By novak100 in forum New To Java
    Replies: 2
    Last Post: 11-19-2009, 12:59 AM
  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, 08: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