Dim SenderFilter As Object = SQL1.ExecNonQueryBatch("SQL1")
You're telling ExecNonQueryBatch to preface the callback with SQL1, yet you preface your callback with just SQL.
So changing
Wait For (SenderFilter) SQL_NonQueryComplete (Success As Boolean)
to
Wait For (SenderFilter) SQL1_NonQueryComplete (Success As Boolean)
should do the trick.
FYI:
Instead of
SQL1.AddNonQueryToBatch("UPDATE TblProva SET Inviato = 1 WHERE Id = " & ID, Null)
do
SQL1.AddNonQueryToBatch("UPDATE TblProva SET Inviato = ? WHERE Id = ?", Array(1, ID))
(
@Mahares does this in his example, using the ExecNonQuery2 method)
1) You can prevent SQL injection attacks this way
2) Depending on the underlying JDBC driver, the driver may cache the "compiled" SQL statement for you. In this case, since the statement is always the same, you may gain some performance improvements.
Point #1 above is really important and Point #2 is just some icing on the cake.
@Mahares:
ExecNonQuery2 is still a blocking call (even with your workaround). Does it matter in the end? Only testing would give an answer (I don't know if a simple Update statement would take much longer in a weak signal environment).