im having a very strange problem and im not sure how to solve it. I have created an image scanning system for a client. I have a gridview which displays the scanned batches which included the batch ID, No. of Documents, No. Recognised and the No. Verified.
When a new batch is run the scanner can process 100+ documents per minute (its quite fast). For each document scanned i create a record in a 'TempImages' Table in SQL Server database to record the batch Number and Image Number as well as other information, I then Update the 'batchSummary' Table with the counts of the Temp Images Table which does a live count as the documents are scanned. I then reload the gridview to show the counts incrementing as the documents are scanned.
The problem im having is very occasionally my client recieved the error "Child List for Field 'BatchSummary' Cannot be created"
This then crashed the application.
I use threading during scanning as i also process and verify each image as it is scanned in.
It looks to me like at a certain point the application is reading from the batch summary on one thread but on another it is updating the record and so the read fails to return results as possibly the table or record has been locked.
Is there any way i can check to see if the record/table has been locked for editing. If it has been locked then i want to be able to skip loading the gridview for that instance.
I have included the code for the GridView Creation and the Insert Statement and Update Statement.
Thanks in advance