Hi
I have below code and i want to update the numberofshift value in records
C#
context.Connection.Open();
context.Transaction = context.Connection.BeginTransaction();
foreach (RepeaterItem item in rptBulkData.Items)
{
MachineShiftDetail objRecord = new MachineShiftDetail
{
NumberOfShift = Convert.ToInt32(txtNoOfShift.Text),
};
context.MachineShiftDetails...InsertOnSubmit(objRecord);
context.SubmitChanges();
context.Transaction.Commit();
}Thanks

Munib ButtRank #156 · 14.9K reputationPosted Dec 15, 2022, 10:56 AM EST
I would suggest to move the below line outside the foreach loop.
context.Transaction.Commit();