A checklist for fixing .NET applications to SQL Server timeout problems and improve execution time

后端 未结 8 1317
离开以前
离开以前 2021-02-02 00:44

A checklist for improving execution time between .NET code and SQL Server. Anything from the basic to weird solutions is appreciated.

Code:

Chan

8条回答
  •  不要未来只要你来
    2021-02-02 01:19

    In the past some of my solutions have been:

    1. Fix the default time out settings of the sqlcommand:

      Dim myCommand As New SqlCommand("[dbo].[spSetUserPreferences]", myConnection)

      myCommand.CommandType = CommandType.StoredProcedure

      myCommand.CommandTimeout = 120

    2. Increase connection timeout string:

      Data Source=mydatabase;Initial Catalog=Match;Persist Security Info=True;User ID=User;Password=password;Connection Timeout=120

    3. Increase transaction time-out in sql-server 2005

      In management studio’s Tools > Option > Designers Increase the “Transaction time-out after:” even if “Override connection string time-out value for table designer updates” checked/unchecked.

    4. Convert dynamic stored procedures into static ones

    5. Make the code call a stored procedure instead of writing an inline sql statement in the code.

提交回复
热议问题