Board index » delphi » MTS and OLE error 8004E00F

MTS and OLE error 8004E00F

Hi,

I created a MTS component named IEmployee that required transaction. If I
created object by using Employee := coEmployee.Create, it worked fine. I
also can monitor the MTS object from then Transaction Server Explorer.

Then I write another MTS component and I want to include these two
components into one transaction. According to the Delphi manual, I wrote the
following codes:

procedure TForm1.Button1Click(Sender: TObject);
var
  TransactionContextEx : ITransactionContextEx;
  Employee : IEmployee;
begin
  TransactionContextEx := CreateTransactionContextEx;
  try
    OleCheck(TransactionContextEx.CreateInstance(CLASS_Employee,
IID_IEmployee, Employee));
    OleCheck(TransactionContextEx.CreateInstance(CLASS_EmpOrder,
IID_IEmpOrder, EmpOrder));
...

But TransactionContextEx.CreateInstance generated the error: OLE error
8004E00F. And the MTX.Exe was not launched at this time. Should I intialize
the MTS environment before I call the CreateInstance method? Or anything
wrong with the code?

Thanks,

Libo

 

Re:MTS and OLE error 8004E00F


Forget it. I have found the reason. I forget to start my MSDTC service. How
stupid I am.

Libo

Quote
Libo <l...@hol.com.sg> wrote in message

news:7f6pb8$k5c25@forums.borland.com...
Quote
> Hi,

> I created a MTS component named IEmployee that required transaction. If I
> created object by using Employee := coEmployee.Create, it worked fine. I
> also can monitor the MTS object from then Transaction Server Explorer.

> Then I write another MTS component and I want to include these two
> components into one transaction. According to the Delphi manual, I wrote
the
> following codes:

> procedure TForm1.Button1Click(Sender: TObject);
> var
>   TransactionContextEx : ITransactionContextEx;
>   Employee : IEmployee;
> begin
>   TransactionContextEx := CreateTransactionContextEx;
>   try
>     OleCheck(TransactionContextEx.CreateInstance(CLASS_Employee,
> IID_IEmployee, Employee));
>     OleCheck(TransactionContextEx.CreateInstance(CLASS_EmpOrder,
> IID_IEmpOrder, EmpOrder));
> ...

> But TransactionContextEx.CreateInstance generated the error: OLE error
> 8004E00F. And the MTX.Exe was not launched at this time. Should I
intialize
> the MTS environment before I call the CreateInstance method? Or anything
> wrong with the code?

> Thanks,

> Libo

Other Threads