Setting CommandTimeout

Posts   
 
    
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 29-Nov-2006 21:42:26   

(v1.0.2005.1, SQL Server 2000 and Adapter vs. .Net 2.0)

Hello,

I understand that I can set the CommandTimeout property of the DataAccessAdapter on a per-call basis.

What I would like to do is set the property globally, and have the change persist even after regenerating the code. Is there an easy way to do this?

Thanks,

Phil

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 30-Nov-2006 03:10:07   

Do you need command timeout or would connection timeout work? Connection timeout can be set in the connection string which would work globally for you.

Here is a post about it from the forum.

http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=2001&HighLight=1

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 30-Nov-2006 10:29:54   

You can also derive a class from DataAccessAdapter, set the timeout in the constructor and use that derived class instead simple_smile

Frans Bouma | Lead developer LLBLGen Pro
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 30-Nov-2006 15:38:07   

bclub: I think I need commandTimeout. There is a particular query that is running over 30 seconds.

Otis: I was hoping there was an easier solution--the project is already in production, so the fewer changes I make, the less re-testing I have to do. The fact that it's 2.0 and uses partial classes doesn't give me any additional options (maybe some unused init event)?

Thanks for your replies,

Phil

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 01-Dec-2006 10:16:24   

If it's one particular query, I'd update that routine's code to set the timeout there. In general it's not always best to set a high timeout for every query, for example when the system is too overloaded to handle the request you'll then always have to wait a looooong time before you find out.

Frans Bouma | Lead developer LLBLGen Pro
Anthony
User
Posts: 155
Joined: 04-Oct-2006
# Posted on: 08-Dec-2006 10:12:16   

I have a similar problem. I am sorting and have a maximum on retunred results. Works fine on my SQL Server computer but appears to timeout on another server using MSDE.

    Dim sorter As New SD.LLBLGen.Pro.ORMSupportClasses.SortExpression()

        sorter.Add(New SD.LLBLGen.Pro.ORMSupportClasses.SortClause(EntityFieldFactory.Create( SBH.Logging.Dal.TblLogFieldIndex.LogId), SD.LLBLGen.Pro.ORMSupportClasses.SortOperator.Descending))

                Me.TblLogCollection1.GetMulti(nothing, 100, sorter)

If i try to return TOP results then it timesout but will work fine if i set MAXIMUM rows to 0!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 08-Dec-2006 10:56:49   

MSDE is limited to a given set of parallel actions. A TOP will create an extra action to execute which can slow down the process on MSDE due to the limitation. The timeout can be set using DbUtils.CommandTimeOut = value;

Frans Bouma | Lead developer LLBLGen Pro