Back
Theme:

Increase timeout using .NET C#


How to increase the timeout using .NET C#? My stored procedure is taking 30 minutes

Date: Tuesday, May 9, 2023
1 answers | 432 view(s)
by Mauricio Junior

Answers

The first point is:

  1. Try to improve your stored procedure to take less time

  2. Try to use the code below to increase the timeout.

    connection.Open(); var command = connection.CreateCommand(); command.CommandText = "EXEC " + _storedProcedure + " " + _parameters; command.CommandTimeout = 2800;

Use the command.CommandTimeout is better.

Tuesday, May 9, 2023

Mauricio Junior


Finanças na prática