I have a static class handling my DB access. When I open an SqlConnection and access it multithreadedly - it closes by itself after 1-2 queries. Nowhere in my code I close it - any thoughts???
Thank you Waldo
When I open an SqlConnection and access it multithreadedly
Then don't access it "multithreadedly" - it's not thread-safe. Instead, open/close it on each thread, preferably with a using statement.
MSDN indicates that instance methods of this class are not thread-safe .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.