Board index » delphi » Creating MTS objects in MTS transactions

Creating MTS objects in MTS transactions

Hi...
  I am trying to create an MTS object under an MTS transaction, using the
example in the Help.  When I try to execute the code, it throws an exception
"OLE error 8004E00F".  The code I am using is shown below. Does anyone know
what the problem might be?

procedure TFormMTSTestMain.ButtonSaveDataClick(Sender: TObject);
var
  SpecificObj : ISpecificMTSClass; // my MTS class that has "Supports
Transactions" set
  TransactionContext : ITransactionContextEx;
begin
  TransactionContext := CreateTransactionContextEx;
  try
    OleCheck( TransactionContext.CreateInstance( CLASS_SpecificMTSClass,
                                                 ISpecificMTSClass,
                                                 SpecificObj ) );

    if SpecificObj.SaveData( EditData.Text ) then
      ShowMessage( 'success' )
    else
      ShowMessage( 'failure' );

    TransactionContext.Commit;
  except
    TransactionContext.Abort;
    raise;
  end;
end;

Thanks...
-Howard

 

Re:Creating MTS objects in MTS transactions


Found it!  The MSDTC was not running.  It's working fine now.
-Howard

Other Threads