トランザクション処理

'-------------------   トランザクション処理   -------------------
Public Function ModuleChangeSW() As Boolean

    On Error GoTo Err_Handle
        
    'トランザクションを開始
    Dim bTranFlag As Boolean    'トランザクション開始フラグ
    
    bTranFlag = False           '初期化
    Cn.BeginTrans               '新規トランザクションを開始
    bTranFlag = True            'フラグを立てる
    
    
   '処理
    Dim strSqlBuff As String
	strSqlBuff = "UPDATE SWDB_SW SET ST_KEY = 1 WHERE SW_KEY = 100"    
     
    Cn.Execute strSqlBuff
    
    
    'コミット
    If bTranFlag = True Then
        Cn.CommitTrans
    End If

    ModuleChangeSW = True
    
    Exit Function
    
    
Err_Handle:

    Call AdoGetError

    'ロールバック
    If bTranFlag = True Then
        Cn.RollbackTrans
    End If

    MsgBox Err.Source & vbCr & Err.Description, vbCritical

    ModuleChangeSW = False
    
End Function
    

<戻る>

テレワークならECナビ Yahoo 楽天 LINEがデータ消費ゼロで月額500円〜!
無料ホームページ 無料のクレジットカード 海外格安航空券 海外旅行保険が無料! 海外ホテル