How can I change the timeout for a manually executed query in SQL Server?

后端 未结 7 1841
终归单人心
终归单人心 2021-01-11 19:15

I have a simple SQL script that I execute manually from Visual Studio. It is a data generation script so I expect it to take a couple of minutes to run. But I get the follow

7条回答
  •  半阙折子戏
    2021-01-11 19:50

    @christian answer did not work for me (changing the settings in SQL Management Studio).

    Biswa answer worked for me. I will include code to clarify

    SqlCommand cmd = new SqlCommand("MyReport", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.CommandTimeout = 60;  /* note default is 30 sec */
    

提交回复
热议问题