问题描述
嗨,我遇到了一个错误Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
我是Alredy更改了连接timeout = 60000,在数据库中,我的过程在43秒内执行.所以请给我一些完美的解决方案
谢谢
推荐答案
您应该注意,
默认情况下,命令超时设置为30秒.将其设置为60,您的问题将得到解决:
commandObject.Timeout = 60;
,但很可能您应该更改SQL过程或将其分为某些零件
其他推荐答案
尝试使用Microsoft SQL Server Management Studio运行SQL查询,然后单击"估计执行计划"按钮.这将告诉您是否缺少任何索引.添加丢失的索引应加快查询.
其他推荐答案
增加查询超时.连接超时仅在连接时间.假设您正在使用SQLCommand,那里有一个超时属性.
问题描述
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
推荐答案
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
其他推荐答案
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.
其他推荐答案
Increase the query timeout. Connection timeout is only on the connection time. Presuming you are using SqlCommand, there is a timeout property in there.