• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

count field incorrect error

 
Werner Fletcher
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created an Access database, with a "Users" table with fields: "personname", "surname", "email", "username", "password", "secretQuestion", "answer".
I am getting a count field incorrect error when i process this:

Please tell me if I did something wrong here, because I don't know and I am ready to
 
Paul Clapham
Sheriff
Posts: 21001
31
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You did two things wrong, actually.

First, your SQL INSERT statement doesn't use the correct syntax. Look here for a page which describes the correct syntax. (You didn't use parentheses.)

Second, constructing an SQL statement that way is error-prone and risky. For one thing, if any of the string values contain quotes -- and they could -- then the result is not valid SQL. And for another thing, it's possible for evil users to uses that statement for "SQL Injection" attacks; humorous example here.

The cure for both of those problems is to use PreparedStatement; you should find that in any reputable JDBC tutorial.
 
Werner Fletcher
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot guys, I appreciate the help alot. I am using PreparedStatement now aswell as MySQL server. I was having endless issues with MS Access and Win 7 64-bit aswell. Everything is working 100%.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic