Hi Forum,
i have problems with the update of one batch (more than 300 can be updated without any problems. Here is some c# code that results in
Could not commit transaction: Error -2035 detected during transaction
i have set the database offline and online again, i am not able to see any database locks.
Thank you very much for your ideas
Tobias
if (BatchStatusLines.Count > 0)
{
CompanyService oCompanyService = myCompany.GetCompanyService();
BatchNumberDetailsService oBatchNumberDetailsService = oCompanyService.GetBusinessService(ServiceTypes.BatchNumberDetailsService);
BatchNumberDetailParams oBatchNumberDetailsParam = oBatchNumberDetailsService.GetDataInterface(BatchNumberDetailsServiceDataInterfaces.bndsBatchNumberDetailParams);
Recordset oRecordSet = myCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
BatchNumberDetail oBatchNumberDetail;
foreach (var BatchStatusLine in BatchStatusLines)
{
BaseLineNumber++;
if ((BaseLineNumber % 10 == 0) || (BaseLineNumber == BatchStatusLines.Count))
{
if (type == DocType.GoodsReceipt)
{
worker.ReportProgress(percentagePerProcess+((BaseLineNumber + 1) * percentagePerProcess / amountlines), "Creating Goods Receipt (Updating Batches)");
}
else if (type == DocType.GoodsIssue)
{
worker.ReportProgress(percentagePerProcess + ((BaseLineNumber + 1) * percentagePerProcess / amountlines), "Creating Goods Issue (Updating Batches)");
}
}
oRecordSet.DoQuery("SELECT AbsEntry FROM OBTN WHERE Distnumber='" + BatchStatusLine.BatchNumberC + "' AND ITEMCODE='" + BatchStatusLine.ItemCodeA + "'");
while (!oRecordSet.EoF)
{
int absentry = (int)oRecordSet.Fields.Item("AbsEntry").Value;
oBatchNumberDetailsParam.DocEntry = absentry;
oBatchNumberDetail = oBatchNumberDetailsService.Get(oBatchNumberDetailsParam);
BoDefaultBatchStatus status = BoDefaultBatchStatus.dbs_NotAccessible;
switch (BatchStatusLine.BatchStatusH.ToUpper())
{
case "NOT ACCESSIBLE":
status = BoDefaultBatchStatus.dbs_NotAccessible;
break;
case "LOCKED":
status = BoDefaultBatchStatus.dbs_Locked;
break;
case "RELEASED":
status = BoDefaultBatchStatus.dbs_Released;
break;
}
oBatchNumberDetail.Status = status;
//Here the error occurs
oBatchNumberDetailsService.Update(oBatchNumberDetail);
oRecordSet.MoveNext();
}
}
}