在SQL中更新时发生超时

在SQL中更新时发生超时

问题描述:

我在更新SQL中的数据时面临超时.该项目是用C#编写的.以前它运行良好,突然从昨天开始我就遇到了问题.请告诉我我应该怎么做.预先感谢

I m facing timeout while updating data in SQL. The project was made in C#. Previously it was working well, suddenly from yesterday I am facing the problem. Please advise me what I should do. Thanx in advance

如果您使用的是OdbcCommand或从Command派生的其他Command,则可以增加超时属性.
除此之外,您还可以检查正在执行的SQL查询并验证是否提供了所有索引.
随着数据库表中数据的增加,您的查询可能突然不再起作用,因为现在查询需要更长的时间才能执行.我认为超时默认为30秒.
If you are using an OdbcCommand or other Command derived from Command, there is a timeout property that you can increase.
Other than that you can check the SQL query you are executing and verify that all indexes are provided for.
As data is increasing in the tables of the database, it is possible that your query suddenly does not work anymore because now the query takes a little longer to execute. I think the timeout is by default 30s.


SqlCommand对象具有CommandTimeout属性,默认值为30秒,尝试增加它:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx [ ^ ]
The SqlCommand object has a CommandTimeout property the default is 30 seconds try increasing it:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx[^]


首先增加CommandTimeout属性,然后如果它继续超时,请确保您的sqlServer.exe已打开并正在运行.
First of all increase the CommandTimeout property then if it continues to time out make sure your sqlServer.exe is open and running.