I'm having the following error executing this piece of code:
private bool _updateList(SysInfo _sysInfo, List<pList> _pList)
{
try
{
foreach (var p in _pList)
{
_context.spUpdatePListApprovalFlow(p.countryID, _sysInfo.User.JobRoleID, p.src, p.id, p.status, _sysInfo.User.Username);
}
return true;
}
catch (Exception ex) //debug only
{
throw; //throws error to the main try catch
}
}
ERROR
The operation could not be performed because OLE DB provider "MSDASQL" for linked server "AS400_LINKEDSRV" was unable to begin a distributed transaction.
However, everything works fine when I run the Stored Procedure in SQL Management Studio:
exec [dbo].[spUpdatePListApprovalFlow]
@CountryID = 123456,
@UserTypeID = 23456,
@Src = 1,
@Id = '123456789',
@Status = 30,
@Username = 'username'
I'm tired of digging for an answer nothing works... Few things I've tried:
- SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
- insert multiple transactions in the stored procedure
This sp has 2 sub stored procedures on it. One that writes into a table of the application's database, and another that updates a table in as400.