Changed the previous one last weekend.ProgramChange a single-threaded Windows service to a new thread triggered by timer each time. The thread contains a database read and update flag transaction. I thought this could solve the problem that the timer interval was not too small, but it caused more difficult problems.
After the analysis, the previous transaction can still read the database. -- This results in repeated data processing;
I used sqlconnection. begintransaction () to create a transaction. However, an error occurs from time to time and an unknown exception is thrown.
Every time you debug the service, you need to append the process.
I found the information and prepared to solve the problem as follows:
ACID properties-ensure that transactions are non-severable, consistent, isolated, and persistent.
Isolation has an attribute isolationlevel in the begintransaction () method that can be set. Try it;
Begintransaction () throws an invalidoperationexception, but it indicates that parallel transactions are not supported.
What I want to find: "check the status of databases and tables (such as lock ......)" The method has not been found. I don't know if this exception can be solved.
And the connection string is: connect reset = true;
The attribute of "isolation level" is serial;
An exception occurred while capturing invalidoperationexception;
Remove CONNECT reset;
The program is normal. The trigger time is set to 1 second.