I'm trying to change values via JDBC, but I keep getting the same problem for various tables and schemas.
Consider that I have a table similar to this.
+----------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+-------+
| field1 | varchar(50) | YES | | NULL | |
| field2 | varchar(50) | YES | | NULL | |
+----------------+-------------+------+-----+---------+-------+
Then I tried to add a row:
String Text1 = text1;
String Text2 = text2;
String Query_String = "INSERT INTO tablename(field1,field2) VALUES ('"+Text1+","+Text2+"')";
Query_Statement.executeUpdate(Query_String);
Although there are the same amount of columns and no further commas in the text, I still receive the message "java.sql.SQLException: Column count doesn't match value count at row 1."
Since I was able to make it work with a single column, I'm confident that it's a simple syntactic error.
Can someone please help me with this?