patrick1980
patrick1980

Reputation: 91

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?

Upvotes: 1

Views: 27

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133360

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

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

Upvotes: 1

Related Questions