• Register
0 votes

Problem :

I am updating values using JDBC but getting bellow error
java.sql.sqlexception: column count doesn't match value count at row 1
6.9k points

1 Answer

0 votes

Solution :

Probably you are making a mistake with your quotes.

The proper Syntax as bellow:

INSERT INTO tablename(field1,field2) VALUES ('Text1,Text2'); 

So you need to write:

String Query_String = "INSERT INTO tablename(field1,field2) 
VALUES ('"+Text1+"','"+Text2+"')"

Further Readings:

36.1k points

Related questions

0 votes
2 answers 57 views
Problem : I am getting bellow error while trying to execute JDBC code java.sql.sqlexception: operation not allowed after resultset closed
asked Nov 1, 2019 peterlaw 6.9k points
0 votes
1 answer 5 views
Problem: I want to check if the very specific value already exists in the database. I am currently accessing database from the java standalone app using the JDBC my queries for inserting records into the db are working so my setup and the connection are perfectly fine. ... near 'd-f05708071f8f' at line 1 But if I attempt to execute above command in the MySQL command line then it works properly.
asked 5 days ago Raphael Pacheco 2.7k points
0 votes
1 answer 12 views
Problem: I am working on Hibernate and now I am facing what I believe is a simple problem with the Hibernate but still I can't solve it. I have written a simple class I would like to persist but still keep facing below error: SEVERE: Field 'id' doesn't have a ... that is not working for me. Initializing the id also did not help me either! I am looking for Hibernate expert to fix my above error.
asked Jul 30 Raphael Pacheco 2.7k points
2 votes
1 answer 13 views
Problem: I am beginner to jTable. I have already attached the jTable to JDBC database. But I don’t know how to retrieve them. My requirement is the saved data must be shown if I restart my program but currently it is not working for me. I have ... studentName"); String myshool = myrs.getString("schoolName"); String myjoining = myrs.getString("joiningDate"); } Can somebody solve my problem ?
asked Mar 24 morrisBson 3.2k points
0 votes
1 answer 5 views