Hey-
I'm using a MySQL connector in VB .Net to execute a batch of SQL inserts. This is typically on the order of 5k statements and takes around 30 minutes to process. Unfortunately, when this process is running and I use a different application on the system, upon returning to the .net app it hangs and shows "not responding". In fact, as soon as I click anywhere else in the application (move to a different tab, for example) everything locks up.
Dim transaction As MySqlTransaction = sqlConnection.BeginTransaction()
For Each sqlCmd In (sqlCmdsCollection)
sqlCommand = New MySqlCommand(sqlCmd, sqlConnection)
Try
sqlCommand.ExecuteNonQuery()
logTxtBox.AppendText(". ")
Catch ex As Exception
transaction.Rollback()
logTxtBox.AppendText(vbNewLine & "EXCEPTION: " & ex.Message & vbNewLine)
logTxtBox.AppendText(sqlCmd & vbNewLine)
logTxtBox.AppendText("INFO: No changes were made to the database!"& vbNewLine)
End Try
Next
transaction.Commit()
Why is this happening?
Is there a more efficient way to execute these inserts?
Thanks-
Jonathan