2013-07-12 3 views
3
public DataTable GetDailycardReport(DailyReportPL dailyreportpl) 
    { 
     DataTable dtGetDailycardReport = new DataTable(); 
     try 
     { 
      SqlParameter[] arParams = new SqlParameter[2]; 

      arParams[0] = new SqlParameter("@farmername", typeof(string)); 
      arParams[0].Value = dailyreportpl.farmername; 

      arParams[1] = new SqlParameter("@batchno", typeof(int)); 
      arParams[1].Value = dailyreportpl.batchno; 

      dtGetDailycardReport.Load(SqlHelper.ExecuteReader(connection.ConnectionString, CommandType.StoredProcedure, "k_DailyCardreport", arParams)); 
     } 
     catch (Exception ex) 
     { 

      //DBExceptionPublisher exc = new DBExceptionPublisher(); 
      //exc.Publish(ex); 
     } 
     finally 
     { 

     } 
     return dtGetDailycardReport; 

    } 

예외 ::은 시간 초과 예외

"Timeout expired. The timeout period elapsed prior to completion of 
    the operation or the server is not responding." 

내가 저장 프로 시저에 매개 변수를 전달의 200에 명령 제한 시간을 증가 괜찮나 " 메시지 위에 표시하는 예외를 붙 잡았다 webconfig에 있습니다 .Google에서 검색했지만 최적화 된 결과가 없습니다.

+1

이 .. –

+1

이 당신의 코드를보기 내 C# 코드 – Bhagavan

답변

7

당신은 또한

cmd.CommandTimeout = 60; 

초 단위의 시간을 지정하여 명령 개체에 설정할 수 있습니다.

+1

* 또는 서버가 응답하지 않습니다. * 기술 지원 가능 "연결 시간 제한"문제가 될 수 있습니다. –

+2

@BobbyDigital * 작업 완료 전 시간 초과 * 기술적으로는 CommandTimeout 문제 일 수 있습니다. –

6

다음과 같이 200 초로 설정하면 연결 문자열에 설정할 수 있습니다.

"데이터 원본 = (로컬), 초기 카탈로그 = AdventureWorks, 통합 보안 = SSPI; 연결 시간 제한 = 200 "

Source

+1

+1을 제공하는 경우 – bigge