title: Count field incorrect error while connecting eclipse to ODBC driver
body: <p>I got this error while trying to create a record into database using microsoft access and eclipse.</p>
  
  <pre><code>    [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect
  </code></pre>
  
  <p>And the Connection showed is closed. Here is my codes to connect to the ODBC driver.</p>
  
  <pre><code>    public class DBController {
  private Connection con;
  
  public void setUp(String dsn) {
      try {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");          
      } catch (Exception e) {
          System.out.println("Load driver error");
      }
      try {
  
          String s = "jdbc:odbc:" + dsn;
          con = DriverManager.getConnection(s, "", "");
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  
  public ResultSet readRequest(String dbQuery) {
      ResultSet rs = null;
      try {
          Statement stmt = con.createStatement();
          rs = stmt.executeQuery(dbQuery);
      } catch (Exception e) {
          e.printStackTrace();
      }
      return rs;
  }
  
  public int updateRequest(String dbQuery) {
      int count = 0;
      try {
          Statement stmt = con.createStatement();
          count = stmt.executeUpdate(dbQuery);
      } catch (Exception e) {
          e.printStackTrace();
      }
      return count;
  }
  
  public void terminate() {
      try {
          con.close();
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And these are my codes to createUser.</p>
  
  <pre><code>        public boolean createUser() {
      boolean success = false;
      DBController db = new DBController();
      db.setUp("IT Innovation Project");
      String sql = "INSERT INTO forumUsers(users_userName,users_password,users_NRIC,users_securityQuestion,users_answer) ";
      sql += "VALUES ('" + userName + "','" + pwd + "','" + nric + "','"
              + securityQuestion + "','" + answer + "')";
      System.out.println(sql);
      if (db.updateRequest(sql) == 1)
          success = true;
      db.terminate();
      return success;
  }
  </code></pre>
  
  <p>I already rearrange the sequence by following the database table column but it still showing the count field incorrect error. So how can I fix it? Any help will be appreciated.
  And this is my swing.</p>
  
  <pre><code>    public void submitSignup(ActionEvent e) {
      String userName = jTextField_userName.getText();
      String pwd = new String(jPasswordField.getPassword());
      String nric = jTextField_nric.getText();
      String securityQuestion = jComboBox_securityQuestion.getSelectedItem()
              .toString();
      String answer = jTextField_answer.getText();
  
      if (userName.equals("") || pwd.equals("") || nric.equals("")
              || securityQuestion.equals("") || answer.equals(""))
          JOptionPane.showMessageDialog(null, "Please enter all text field");
      else {
          eForumUser user = new eForumUser(userName, pwd, nric,
                  securityQuestion, answer);
          if (user.isExist())
              JOptionPane.showMessageDialog(null,
                      "User already exists! Cannot create.");
          else {
              if (user.createUser() == true)
                  ;
              JOptionPane.showMessageDialog(null,
                      "User record created successfull!");
          }
      }
  }
  </code></pre>