I have a process where two threads are continuously executing sql queries on the same tables. Is there any chance that one of these two threads gets Timeout error? If so, what is the best practice to avoid this?
I am getting following error and resulting is process crash.
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Sounds like you’ve got a lock on a table. Look into locking mechanisms. If you lock entire table, it’s inefficient, instead, you can lock a subset of a table, i.e. – row.
Also in your connection string, you can decrease the timeout. Change it to 2 seconds (time to establish connection, not query data). If you do get that error, than you can work from there.