Search code examples
c#sql-serverwindowswinformsdatabase-deadlocks

How to avoid database-deadlock occurring while storing & retrieving data same time?


We developed a windows application, the application used like as regular application works; gathering huge information, processing on it, and generating reports...And to store Data we used SQL Server. For reports we used Crystal Reports.

There are more than 150 employees in our office using the application. Most of them are Data Entry operators. So while Data Storing suppose anyone tries to generate report, application stopped working & deadlock occurs. There are different threads created for storing information and different threads for retrieving the same (Or generating reports).

So the question is how to avoid dead lock situation, because Storing data & generating reports is continuous procedure can't ask to store data first, then process on it and then generate reports...

How to do both things simultaneously i.e. storing and retrieving data? Is there any way so deadlock won't occur?

Whatever suggestions or query related to this are welcome..

UPDATE

In this scenario, Is using Views helpful?

Thank You!!


Solution

  • By default, with ODBC connections, Crystal Reports uses the highest database isolation level the driver supports, which is Read Committed. You can add a registry key to instruct Crystal to use a lower isolation level.

    Here is a document providing full instructions: 1216415 - How to change the isolation level for an ODBC connection in Crystal Reports?