I have a background worker thats doing some database work for me. The reason why I resorted to using using the background worker is because the database work is taking up a lot of time. So the code work the first time but as you continue to update the database then then you get "Could not save; currently locked by another user. OledbException was unhandled". Is the a way to go around this issue. This is my code

Private Sub BackgroundWorker1_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
    DoSaveUsersAuditForUpdate_Click()
End Sub

And I am running it in my Update button click event using

  BackgroundWorker1.RunWorkerAsync()

how can I know

If there is already a background worker taking up the resources the lock will mean the new background worker wont be able to access the resource so you will have to put an action listener in to check when the resources become available.

Also try to make your queries more efficient to reduce execution time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.