I was wondering if anyone can help me I have this table:
create table User
dbUserId integer not null primary key auto_increment,
dbFirstNames varchar(50) not null,
dbSurName varchar(50) not null,
dbPassword varchar(12) not null,
dbEmail varchar(50) not null,
dbFaculty varchar(50) not null,
dbSecurityId integer not null references Security(dbSecurityId),
dbAuthorId integer not null references Author(dbAuthorId) (I don't want to use this column, Its for checking only)
which as you can see have 3 keys, 2 of them are refernced.
However, when I want to insert values into my database, I get this error:
"failed.java.sql.SQLException: General error: Column count doesn't match value count at row 1"
I understand the error its due to my table has 8 columns, but I only want to use 7 columns.
Here is the code for my JDBC connection:
String sqlQuery = "INSERT INTO User VALUES ('?' '" +
bnFirstname + "', '" + bnSurname + "', '" +
bnPassword + "', '" + bnEmail + "', '" +
bnFaculty + "', '" + bnSecurityId + "')";
Technologies I'm using are:
1. MySQL 3.23.5
2. Tomcat 4.0.4
3. JSP 1.2
Please can anyone help to me fix this problem or give some tips.