Changing SqlConnection timeout

后端 未结 10 2121
孤街浪徒
孤街浪徒 2020-12-25 09:22

I am trying to override the default SqlConnection timeout of 15 seconds and am getting an error saying that the

property or indexer cann

10条回答
  •  攒了一身酷
    2020-12-25 10:00

    If you want to provide a timeout for a particular query, then CommandTimeout is the way forward.

    Its usage is:

    command.CommandTimeout = 60; //The time in seconds to wait for the command to execute. The default is 30 seconds.
    

提交回复
热议问题