'------------------- トランザクション処理 -------------------
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