C # Run the SQL statement to report that the timeout has expired

Source: Internet
Author: User

During project creation, SQL query times out frequently. Today, we met the transaction processing involved. when the transaction is not committed, we need to query the data in the new insert statement. The result has never returned, and the query timeout has expired. I found a lot of information and still did not solve the problem. After reading the explanation of the transaction isolation option, consider whether the uncommitted transaction cannot be accessed due to the new connection query, and try to change the isolation option to accessible dirty data, then execute the query using the oledbcommand of the transaction and return the result. The result is normal. It seems that this problem is the cause. When you encounter such a problem, consider it to see if the main problem is that too many updates, insert, and select statements are in the same transaction. In this way, before submitting the statement, the query may be congested and time-out; whether the required functions cannot be implemented due to incorrect transaction isolation options; whether the network condition is poor, you can consider setting the query timeout time-out a little longer. Sometimes it is troublesome to use oledb. Instead, you can use a set of SQL classes to solve some problems. You can also consider replacing the implementation method.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.