Creating ClientPrj for a Distributed Transaction
This code sample provides detail code for creating ClientPrj.vbp.
Note: This sample code has message box
statements to help better understand the step-by-step flow of the code. Since DTC is
managing the transactions, it is necessary not to lock the tables for a long time. When you
use message boxes, you stop the program flow. When regression testing, you must remove all
of the message boxes. You can write to a log file instead.
Private Sub Command2_Click() Dim szConnect As String szConnect = "Driver={SQL Server};" & _ "Server=AServerName;Uid=UserID;Pwd=Passwd;Database=DBName" '(NOTE: You may need to change the connection ' information to connect to the database.) Dim obj As Object Set obj = CreateObject("MTStest.MTSTestClass") MsgBox obj.Database_Test_Method(szConnect) Set obj = Nothing Unload Me End Sub Private Sub Form_Load() Command2.Caption = "Call Database_Test_Method" End Sub