リトライする

'*******************************
'* DBコネクションを返却する
'*******************************
Public Function getDbConServer() As ADODB.Connection
    Dim errCnt%: errCnt = 0
On Error GoTo LBL_Err

Retry:
    If Len(MyConnectionStr$) = 0 Then
        Call setConnectionStr$
    End If

    'オブジェクト生成
    Dim cn As ADODB.Connection: Set cn = New ADODB.Connection
    cn.Open MyConnectionStr$    'DBオープン
    
    Set getDbConServer = cn
    Exit Function
    
LBL_Err:
    Dim erNum: erNum = Err.Number
    Dim erMsg$: erMsg = "getDbConServer:" & Err.Description
    objlog.Error erMsg
    errCnt = errCnt + 1
    If errCnt > 5 Then
        Err.Raise Number:=erNum, Description:=erMsg
    End If
    Call WaitSec(30)
    Resume Retry
    
End Function

/* -----codeの行番号----- */