MTSTestClass : MTStest.bas

You can use this sample code to create MTStest:

Option Explicit
 Public Function Database_Test_Method(_ByVal szConnect As String) As String
 
 Dim stmt As String

 On Error GoTo errhandler

 Dim ctxObject As ObjectContext
 Set ctxObject = GetObjectContext()
      
 Dim MsgBoxRes
 Dim cn As ADODB.Connection
 Dim rsSelect As ADODB.Recordset
 Dim rs As ADODB.Recordset
  
 Set cn = New ADODB.Connection
 With cn
   .ConnectionTimeout = 10
   .ConnectionString = szConnect
   .Open
 End With
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' SONUM and LASTSONUM are columns created in a database called ' 
' COMPLUS. '
' Database server is called soe2pctest.                 '
' LASTSONUM gets incremented when commit is used.            '
' Change these values according to Database created           '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 Set rs = New ADODB.Recordset
 Set rsSelect = New ADODB.Recordset
 rsSelect.Open "SELECT LASTSONUM FROM soe2pctest", cn, adOpenDynamic, 
_ adLockReadOnly
 Dim i As Integer
 For i = 1 To 3

 stmt = "Update SOE2PCTest set LASTSONUM=" & rsSelect(0).Value + 1& & 
" where SONUM = 1"
 cn.Execute stmt, 1, -1
 rsSelect.Close

 Dim c As OWTXClass
 Set c = New OWTXClass

 c.run

 Set c = Nothing
 cn.Close

 Set rs = Nothing
 Set cn = Nothing
 MsgBoxRes = MsgBox("Do you want to Commit?", vbYesNo, "Transaction 
 Decision")
 If MsgBoxRes = vbYes Then
  ctxObject.SetComplete
 Else
  ctxObject.SetAbort
 End If
 Next I

 Exit Function

errhandler:
 Err.Raise vbObjectError, "MTSTest.MTStest.Database_Test_Method", _ 
Err.Description
 ctxObject.SetAbort
 Exit Function

End Function