2009-07-29 5 views

답변

29

아니요 연결마다가 아니라 명령 단위입니다.

편집 2013 년

월 코멘트에서 요청 바와 같이 : 명령 실행을위한

말한다

commands and execution time outs in SQL Server (DBA.SE)에 대한 메모 더보기 기타 내용 : What happens to an uncommitted transaction when the connection is closed?

+0

이것을 다루는 문서에 대한 링크가 유용 할 것입니다. –

+1

@RichardEv : done – gbn

3

연결 문자열에 대해서만 연결 시간 제한을 설정할 수 있습니다. 쿼리 시간 제한은 일반적으로 명령 시간 초과에 있습니다. (우리가 여기에서 말하고 있다고 가정하면 .net, 나는 정말로 당신의 질문에서 말할 수 없다).

그러나 명령이 컨텍스트 연결 (명령 문자열에서 "context connection = true"로 열린 SqlConnection)에 대해 실행될 때 명령 시간 제한이 적용되지 않습니다. 코드 만에서

+0

다른 사람들에게 연결 문자열을 사용할 수 있습니다. –

1

:

namespace xxx.DsXxxTableAdapters { 
 
    partial class ZzzTableAdapter 
 
    { 
 
     public void SetTimeout(int timeout) 
 
     { 
 
      if (this.Adapter.DeleteCommand != null) { this.Adapter.DeleteCommand.CommandTimeout = timeout; } 
 
      if (this.Adapter.InsertCommand != null) { this.Adapter.InsertCommand.CommandTimeout = timeout; } 
 
      if (this.Adapter.UpdateCommand != null) { this.Adapter.UpdateCommand.CommandTimeout = timeout; } 
 
      if (this._commandCollection == null) { this.InitCommandCollection(); } 
 
      if (this._commandCollection != null) 
 
      { 
 
       foreach (System.Data.SqlClient.SqlCommand item in this._commandCollection) 
 
       { 
 
        if (item != null) 
 
        { item.CommandTimeout = timeout; } 
 
       } 
 
      } 
 
     } 
 
    } 
 
    
 
    //.... 
 
    
 
}

관련 문제