Increasing the Command Timeout for SQL command

前端 未结 5 1752
死守一世寂寞
死守一世寂寞 2020-12-08 09:04

I have a little problem and hoping someone can give me some advice. I am running a SQL command, but it appears it takes this command about 2 mins to return the data as there

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-08 09:44

    Setting command timeout to 2 minutes.

     scGetruntotals.CommandTimeout = 120;
    

    but you can optimize your stored Procedures to decrease that time! like

    • removing courser or while and etc
    • using paging
    • using #tempTable and @variableTable
    • optimizing joined tables

提交回复
热议问题