Query times out from web app but runs fine from management studio

前端 未结 8 1482
盖世英雄少女心
盖世英雄少女心 2020-12-01 05:13

This is a question I asked on another forum which received some decent answers, but I wanted to see if anyone here has more insight.

The problem is that you have one

相关标签:
8条回答
  • 2020-12-01 06:12

    Try changing the SelectCommand timeout value:

    DataAdapter.SelectCommand.CommandTimeout = 120;
    
    0 讨论(0)
  • 2020-12-01 06:13

    I've had similar problems. Try setting the with "WITH RECOMPILE" option on the sproc create to force the system to recompute the execution plan each time it is called. Sometimes the Query processor gets confused in complex stored procedures with lots of branching or case statements and just pulls a really sub-optimal execution plan. If that seems to "fix" the problem, you will probably need to verify statistics are up to date and/or break down the sproc.

    You can also confirm this by profiling the sproc. When you execute it from SQL Managment Studio, how does the IO compare to when you profile it from the ASP.NET application. If they very a lot, it just re-enforces that its pulling a bad execution plan.

    0 讨论(0)
提交回复
热议问题