Hi All,
So I’m testing my first converted BPM from E9 that updates a database table and I can’t seem to get it working.
Below is my code.
This BPM is updating OrderRel.ReqDate whenever and associated Job’s Due Date is updated.
This is a Post Processing BPM on JobEntry.Update.
When this runs, the error is:
Description: The underlying provider failed on EnlistTransaction.
Inner Exception: The operation failed because the session is not single threaded.
Any ideas what I have wrong?
Erp.Tables.JobProd JobProd;
Erp.Tables.OrderRel OrderRel;
foreach (var ttJobHead_iterator in (from ttJobHead_Row in ttJobHead
where ttJobHead_Row.Company == Session.CompanyID
select ttJobHead_Row))
{
var ttJobHeadRow = ttJobHead_iterator;
foreach (var JobProd_iterator in (from JobProd_Row in Db.JobProd
where string.Compare(JobProd_Row.Company, ttJobHeadRow.Company, true) == 0
&& string.Compare(JobProd_Row.JobNum, ttJobHeadRow.JobNum, true) == 0
select JobProd_Row))
{
JobProd = JobProd_iterator;
if (JobProd.OrderNum > 0)
{
using (var txscope1 = IceDataContext.CreateDefaultTransactionScope())
{
OrderRel = (from OrderRel_Row in Db.OrderRel
where string.Compare(OrderRel_Row.Company, JobProd.Company, true) == 0
&& OrderRel_Row.OrderNum == JobProd.OrderNum
&& OrderRel_Row.OrderLine == JobProd.OrderLine
&& OrderRel_Row.OrderRelNum == JobProd.OrderRelNum
select OrderRel_Row).FirstOrDefault();
if (OrderRel != null)
{
OrderRel.ReqDate = ttJobHeadRow.ReqDueDate;
Db.Validate(OrderRel);
}
txscope1.Complete();
}
}
}
}
Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
addr: 37 Shuman Ave | Stoughton | Ma | 02072-3734
jrojas@... | www.matsinc.com
Ask us about our clean, green and beautiful matting and flooring
[cid:b5ee6f.png@8875290c.4b8fd0c1]
This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.
[Non-text portions of this message have been removed]