Hello,
I have a database connection defined and it works.
I have a resultset fill with a "select" statement and it works.
I am iterating the previous resultset with a "while" control sentence.
I have a prepared Statement for database update well defined:
AND If I put the update prepared statement outbounds of the "while" loop the sentence works perfectly,
BUT if put the same prepared statement inside the "while" loop it gives the following error:
"FlexScript exception: Commands out of sync; you can't run this command now".
Database.PreparedStatement statement = con.prepareStatement("UPDATE TABLE SET STATUS=1 WHERE ID = :id");
statement.bindParam("id", id, Database.DataType.Int);
statement.execute();
1.- Does anybody know why it gives this error?
2.- I have to update a database for each row in a resultset (for each data I read of the resultset I have to update it in the database), how can I do it?
Thanks in advance.