Hey all, I have 3 radio buttons and i'm trying to insert the values of the radio buttons. I also have 3 combo boxes for date,month,year.
In my database i have my radio buttons set to varchar and my combo boxes date,month,year are varchar also..but i dont know if this is the right way. I also don't know if my SQL statement is right. I'm getting this error when i compile program
java.sql.SQLException: General error, message from server: "Column count doesn't match value count at row 1"
PreparedStatement p = con.prepareStatement("INSERT INTO customerdetails(Title,Username,Password,FirstName,Surname,Address,City,Email,TelephoneNum,cardType, cardNum,date,month,year,shipTitle,shipSurname,shipAddress,shipCity,shipCountry,shipPostalCode)VALUES('" +radio+"','"+Username+"','"+Password+"','"+FirstName+"','"+Surname+"','"+Address+"','"+City+"','"+Email+ "','"+telephoneNum+"','"+radioB+"','"+cardNum+"','"+date+"','"+month+"','"+year+"','"+radioBtn+"','" +shipName+"','"+shipSurname+"','"+shipAddress+"','"+shipCity+"','"+shipCountry+"','"+shipPostalCode+"')"); int affectedRows= p.executeUpdate();
[Edited by Jeanne to add linebreaks] [ May 31, 2004: Message edited by: Jeanne Boyarsky ]
Well - you KNOW your statement is incorrect when you get an error. 'Column count does not match' means 'Column count does not match' - it's always a good idea to read the errormessage and to interpret it.
Here I found the suspicious columns - 3 and 4.
It would be nice, if you edit your post (pencil-paper-icon), and insert some spaces in the very long rows, to give the program working in the background a chance to split them - thanks.