patrick1980 patrick1980 - 26 days ago 7
Java Question

Adding a second column caused an error

In my database i have 1 column, i intercede to her my ArrayList and everything works.

for(LatLng s : list1)
{
String sql = "INSERT INTO table1 VALUES('"+s+"')";
stmt.executeUpdate(sql);
}


Now i want another column "ID" with
auto increment
, so i make this in
phpmyadmin
.

Name
ID
, type
int
with
auto increment
.

But now with 2 column, my method didn't work.

What did I do wrong?

Answer

If you have more then one column you should indicate the column name

"INSERT INTO table1 (your_column_name)  VALUES('"+s+"')"
Comments