I'm working on an import application. I have to execute a lot of inserts from a lot of files, and I guess use ExecNonQueryBatch should be faster than execute one by one.
Then, I'm using AddNonQueryToBatch to finally call ExecNonQueryBatch once about 60000 inserts are collected.
The problem I face is, because ExecNonQueryBatch is async, my app continues execution and finish (console project)
I tried to add this sub changin the value of a global, and a fake loop just to wait.
Do While importTerminado = False
Loop
'.....
Sub SQL_NonQueryComplete (Success As Boolean)
importTerminado = True
End Sub
But seems don't works, just stop without finishing. I know it don't works because I have later console logs don't showing. Records are not created either, but I don't get any message in console after the frist telling the process started.
Dim termina As Long = DateTime.Now
Dim diferencia As Period = DateUtils.PeriodBetween(inicio, termina)
Log(diferencia)
query = "INSERT INTO zz_import_aux VALUES('"&fichero&"', NOW(), "& contador&")"
conn.ExecNonQuery(query)
Log("Procesados " & contador & " registros")
What I'm doing wrong?