'Error while inserting data into linked server: no transaction is active

I tried to use below query to insert data into the linked server. But I getting an error:

No transaction is active

Could someone please help?

begin
declare @i int = 11
begin tran
 insert into [Projects_JIT].[dbo].[user] values (3803,'Tstname',3799,'tst','name',3330000042)
 
 if @i=11
 begin
  insert into [Projects_JIT].[dbo].[MonthToManager](monthid,managerid,submitted,DateSubmitted)
   values (41,3799,0,null)
  commit
 end
 else
 begin
  rollback
 end
end

Error msg:

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source