Timeout expired. The timeout period elapsed prior

2019-03-06 19:51发布

hi I'm getting an error Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
I'm alredy changed the connect timeout = 60000 and in database my procedure is executes in 43sec. so plz give me some perfect solution

thank you

3条回答
来,给爷笑一个
2楼-- · 2019-03-06 20:14

Increase the query timeout. Connection timeout is only on the connection time. Presuming you are using SqlCommand, there is a timeout property in there.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-03-06 20:35

You should note that Timeout property for SqlConnection object and Timeout property for SqlCommand object are different properties.
By default command timeout is set to 30 seconds. Set it to 60, and your issue will be solved:

commandObject.Timeout = 60;

But most likely that you should change your SQL procedure or split it to some parts

查看更多
欢心
4楼-- · 2019-03-06 20:40

Try running your SQL query using Microsoft SQL Server Management Studio, and click the "Estimated Execution Plan" button. This will tell you if you have any indexes missing. Adding the missing indexes should speed up your query.

查看更多
登录 后发表回答