Lock error in sql server after updating and selecting -


in code, need assign pallet number selected carton boxes.

once user selects boxes(15-30 boxes) , press ok, run following code.

//update pallet no selected cartons            foreach (datagridviewrow item in dgvcartondetails.rows)             {                 dblayer.tblcartonupdatepalletid(item.cells["cm_id"].value.tostring(), pno, _settings.line.tostring());      //stored procedure:tblcartonupdatepalletid     //update tblcarton set cm_palletid = @palletid, cm_cartoncompletetime = getdate() cm_id = @cm_id             }             //print boxes in pallet             dblayer.tblprintallcartonsofthepallet(palletid);      //stored procedure: tblprintallcartonsofthepallet     //select * tblcarton cm_palletid = @palletid 

some times face lock error (ref pic).

enter image description here

i have given stored procedure data referance. carton table increase @ rate of 5000 records/day.

i dont know missing. should into? in advance.

there must process running @ same time. need identify is. best thing if possible capture deadlock in profiler show processes deadlocked , 1 resource.

i assume run 2 queries in 1 transaction.

if there 2 processes running code above, may happen update tblcarton @ same time. first 1 updates record on page 1 , second updates record on page 2. need update pages in reverse: first needs update page 2 , second page 1. result in deadlock.

without getting deadlock report profiler, it's hard if happening sure, though.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -