February 5, 2025 at 11:34 am
Following error comes while executing an SQL query.
Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
This happens after 30 seconds, even though I have set the Command Timeout property to 300 seconds.
Here’s what I’ve already verified:
The connection is working fine. I've checked the remote query timeout, and it's set to 0 (unlimited). There are no packet drops or network issues. The query is optimized, properly indexed, and runs in seconds directly on SQL Server. There are no deadlocks, blocking processes, or transactions affecting the command. Connection pooling is not in use, and SQL logs show no issues.
Any suggestions or insights on what could be causing this issue would be greatly appreciated!
February 5, 2025 at 11:38 am
You say it runs in seconds when run 'directly'. So presumably you are running it 'indirectly' – can you elaborate on that?
February 5, 2025 at 11:55 am
I’m running the SQL query through VB.NET code. To check if the query execution time was slow, I executed the query directly on SQL Server and verified that it runs in seconds. The issue with the timeout occurs when I run it through the VB.NET code, even though the query itself executes quickly on SQL Server.
February 5, 2025 at 11:58 am
OK, understood. Is this a fundamental connection problem (ie, all queries time out), or is there just one particular query which is giving the issue?
February 5, 2025 at 12:40 pm
Which Isolation Level are you using to execute the command in VB.Net ?
Isolation Levels explained by Kendra Little
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
February 5, 2025 at 1:04 pm
It happens for a particular SELECT query, but the error doesn't occur consistently,it's generated randomly.
February 5, 2025 at 1:07 pm
Does the query contain variables or parameters?
February 5, 2025 at 1:09 pm
I am using the read committed isolation level to execute the command
February 5, 2025 at 1:12 pm
And are you using prepared statements?
February 5, 2025 at 1:51 pm
the query does not contain any variables or parameters
February 5, 2025 at 2:08 pm
No . im not using Prepare() statement
My VB.NET code is in the below format
Dim command As New SqlCommand(query, connection)
command.ExecuteReader()
February 5, 2025 at 2:10 pm
This was removed by the editor as SPAM
February 5, 2025 at 2:49 pm
I am running out of ideas.
As this happens for only one query, there must be something about that query which is different from all the others. Is there anything special about it, either in terms of how it is structured or how it is executed?
February 6, 2025 at 8:40 am
No , a normal select query with few where conditions followed by a ordey by clause
February 6, 2025 at 9:03 am
OK, I'm done. Please post back with details when you manage to resolve this – it may help others in future.
Viewing 15 posts - 1 through 15 (of 18 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy