HashMapをAccessデータベースに挿入しようとしていますが、エラーが発生し続けます。 は、ここに私のコードです:HashMapをJavaのデータベースに挿入する方法
for (Entry<String, String> entry : mapImpedanceAll.entrySet()) {
prep1 = entry.getKey().replaceAll("\\s", "_");
prep1=prep1.replace(":","");
prep1=prep1.replace("<","LessThan");
prep1=prep1.replaceAll("\\." ,"");
prep1=prep1.replaceAll("\\(s\\)" ,"");
prep1=prep1.replaceAll(",$" ,"");
prep1=prep1.replaceAll("%" ,"");
prep1=prep1.replace("-" ,"_");
prep1=prep1.replace("_" ,"");
if(dbColNames.contains(prep1)){
try {
Statement qu = null;
qu =conn.createStatement();
String stg = "INSERT INTO Impedance2 "+prep1+" VALUES('"+entry.getValue()+"')";
qu.execute(stg);
} catch (Exception e) {
e.printStackTrace();
}
}
}
、ここでエラーです:私はその何かが声明String stg = "INSERT INTO Impedance2 "+prep1+" VALUES('"+entry.getValue()+"')";
で行うことが確信している
net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.4 row column count mismatch
が、私はそれを周りにプレイしたのだが、それでもトリップアップ。私はあなたのサンプルコードは、次の操作を実行しようとしたHashMap