Prepared Statement & Microsoft ACCESS JDBC:ODBC

Hello everybody,

I'm trying to figure out why Java returns me this error ion various situation:

java.sql.SQLException: [Microsoft][Driver ODBC Microsoft Access]COUNT field incorrect.

As you can see I'm trying to use a Prepared stetement with jdbc:odbc(is possible, isn't it?)

The problem is that in every way I try to use the prepared Statement it returns me this error.

If i fill up fields with a big SQL query everything it's ok.

askSQL =conn.prepareStatement("INSERT INTO pippo(Campo1,Campo2,Campo3) VALUES (?,?,?) ");

Iterator Idati_articolo = lista_articoli.iterator();

if (Idati_articolo.hasNext()){

while (Idati_articolo.hasNext()){

ArticoloBean myBean2 = (ArticoloBean)Idati_articolo.next();

askSQL.setString (1,"pippoa");

askSQL.setString(2,"plutoa");

askSQL.setString(3,"giannia");

}

}

askSQL.executeUpdate();

[1208 byte] By [Pentolinoa] at [2007-11-27 7:59:24]
# 1

As you can see I'm trying to use a Prepared stetement with jdbc:odbc(is possible, isn't it?)

sorry, don't know about odbc...

... you can delete this statement...., while (Idati....) is sufficient.

if (Idati_articolo.hasNext()){

j_shadinataa at 2007-7-12 19:41:27 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
up
pentolinioa at 2007-7-12 19:41:27 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
Your executeUpdate statement is in the wrong place. It belongs inside the while loop after the setString calls.As currently configured your code will throw an exception if there are no elements in the iterator because no parameters ever get values bound to them.
cotton.ma at 2007-7-12 19:41:27 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...