在我的數據庫中,我有1列,我向她介紹我的ArrayList,一切正常。添加第二列導致錯誤
for(LatLng s : list1)
{
String sql = "INSERT INTO table1 VALUES('"+s+"')";
stmt.executeUpdate(sql);
}
現在我想另一列 「ID」 與auto increment
,所以我認爲這種方式phpmyadmin
。
名稱ID
,類型int
與auto increment
。
但現在有2列,我的方法沒有工作。
我做錯了什麼?
請採取基本的SQL教程。 –
你不能簡單地添加這樣的列。 – ItamarG3
請不要將值連接成像這樣的查詢;它讓你打開SQL注入和其他微妙的問題。請[瞭解如何使用預準備語句](http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html)。 –